The Search API may return five types of errors:

  • Authentication errors
  • Invalid Accept-type errors
  • Server-side errors
  • Client-side errors
  • End-user errors

The first two types of errors, authentication and invalid Accept-type errors, do not return any error response body. Invalid Accept-type errors return an HTTP 406, and authentication errors return an HTTP 401. In the case of a 401 or 406 error there will be an error message in the HTTP reason-phrase.

The final three error types all return error-response bodies. Server-side errors return an HTTP 500 status, and indicate a server-side failure. This can happen if the server is currently experiencing technical difficulties, or in the case of a malfunction. Client-side errors return an HTTP 400 status code, and indicate a coding error in the client. This will happen in the case of invalid syntax, incorrect encoding, incorrect escaping, or in general any error that causes the server to not be able to interpret the request. End-user errors may occur on normal responses with HTTP 200 status. Since end users will likely have no way of seeing the HTTP status, and viewable results may be returned regardless of an end-user error, these errors are simply included in the response payload. These errors may include things like bad query syntax within a search, even if the search request is correctly formed, escaped, and encoded.

Example - Client side 400 error

Bad query issued by client:
       message="Error with command: addFacetField: Wrong number of arguments: 1"/>
       message="Error with command: fubar: Unknown command string: fubar"/>

Try It

For more specific information on the error field format, see Errors Response Field.