Steps to reproduce:
We need to simulate a long automation call bound to a select2 widget (to simulate a load of document). To do so, let's set a breakpoint in org.nuxeo.ecm.platform.suggestbox.automation.SuggestOperation.run() and plug your debugger to a Nuxeo instance
2- type whatever in the top right corner search field
3- press enter while it is searching
4- see the alert windows saying "Error while querying data from server: "
The root cause is that clicking the Enter key while searching will trigger a navigation which fires a window unloaded event caught by jquery which will abort all pending ajax call.
If ajax call has a failure callback, it will be called (typically the case for select2).
Fix consists in displaying the alert window only if a sever internal error is detected (500).