Errors

The error formats and codes of the run, upload, and realtime endpoints.

The upload and run endpoints return errors as HTTP responses, and realtime sessions send them as error messages. Both include a stable code to handle in your application and a message for logs and debugging. Some codes, such as config_invalid, message_invalid, and internal_error, appear in both with the same meaning.

HTTP errors

The audio upload, image upload, and run endpoints return an error as a JSON body with a 4xx or 5xx status. The status says how the request failed, and code says why.

Each of these endpoints also documents its errors in its own guide: audio upload errors, image upload errors, and run errors.

Response format

400 Bad Request
{
"type": "error",
"code": "config_invalid",
"message": "the config part is not valid: unknown field `timer_ms`, expected `measurement_timer_ms` at line 1 column 11",
"request_id": "3f9a1c07e2b84d56a0c7e19b5d2f8a64"
}
type

Always error.

code

A stable string to branch on. See HTTP codes.

message

A description for logs and debugging. The wording may change without notice.

request_id

Identifies the request in Hume’s records. Quote it when contacting support.

A 401 is answered before the request reaches the service, so its body has no type or code. It carries only a message, and a request_id when an API key was rejected. See Authentication.

HTTP codes

StatusCodeEndpointsDescription
400message_invalidUploadThe multipart body could not be read, is missing its file part, or carries a part with another name. Audio upload takes exactly one file part; image upload takes one or more.
400config_invalidUploadThe config part is not valid JSON, names an unrecognized field, holds a value outside its range, or appears more than once.
400audio_decode_failedAudio uploadThe audio could not be decoded: a WAV file that is truncated or malformed, is at another sample rate, channel count, or sample format, or uses the extensible WAV header, or a file that is empty or is not a whole number of 16-bit samples.
400image_decode_failedImage uploadAn image could not be decoded.
400invalid_requestRunsA query parameter has a value the endpoint does not accept, or cursor is not one the endpoint issued.
401NoneAllThe request carried no valid API key or access token. See Authentication.
403forbiddenUploadYour organization is not permitted to use this endpoint. Contact support.
404not_foundAllNo run with this ID exists in your organization, or no endpoint exists at this path.
405method_not_allowedAllThe endpoint does not accept this HTTP method. The Allow header lists the methods it does accept.
413audio_too_longAudio uploadThe request body is over the size limit.
413image_too_largeImage uploadThe request body or one image is over the size limit, or an image has more pixels than the endpoint accepts.
415unsupported_media_typeUploadThe audio is in a format the server recognizes but does not accept, such as MP3 or FLAC, or an image is not a JPEG.
500internal_errorAllThe server failed while serving the request.
503server_busyAllThe service is too busy to serve the request now.

Retrying

  1. A request that failed with a 4xx status fails again if sent unchanged. Correct what code names first. A 403 is not caused by the request, so contact support instead.
  2. After a 500, retry the request. If it keeps failing, contact Hume with the request_id.
  3. After a 503, wait before retrying. The response carries a Retry-After header giving the number of seconds to wait.

Realtime errors

A realtime session reports a problem as an error message. After a recoverable error, the session continues. After an unrecoverable error, it sends session.closed and closes the connection.

Codes that only one endpoint sends are documented in that endpoint’s guide: audio errors and video errors.

Message format

error
{
"type": "error",
"code": "rate_limited",
"message": "audio ingest is outpacing the realtime limit; frame dropped",
"retryable": true
}
type

Always error.

code

A stable string to branch on.

message

A description for logs and debugging. The wording may change without notice.

retryable

false for every error that ends the session, and true for every error the session survives. The exception is internal_error on the video endpoint, where it says whether the failure was temporary and the frame is worth resending.

On the audio endpoint, the server replies only to a rejected frame, with an error. On the video endpoint, it replies to every frame, and Matching results to frames explains how to pair each reply with the frame it answers.

Shared codes

CodeSessionDescription
message_invalidContinuesA text message was not valid JSON, had no type field, or had a type the endpoint does not recognize. Media must be sent as binary frames, not as text.
rate_limitedContinuesMedia arrived faster than the endpoint allows, and the frame was not processed. Slow down, and resend the frame if the stream must be continuous.
config_invalidEndsA session.update contained an unrecognized field or an unsupported value, or arrived after the configuration locked at the first media frame. See Configuration.
message_too_largeEndsA WebSocket message exceeded the endpoint’s size limit: 1 MiB on the audio endpoint, 2 MB on the video endpoint. Send smaller messages.
internal_errorVariesProcessing failed unexpectedly. On the audio endpoint the session ends. On the video endpoint the frame is skipped and the session continues, until five consecutive frames fail.

When an error ends the session, the error is followed by session.closed with reason set to error, and the connection closes with code 1008. Open a new connection to start another session.

The problems a session reports, such as rejected frames and failed measurements, are also recorded in its event log. Getting events describes the endpoint that returns the log and every kind of event in it.

Close codes

When the server ends a session, it closes the WebSocket with one of these codes. The code shows whether session.closed was sent first. Close frames carry a code and no reason text, so the reason is in session.closed. Closing lists the code for each reason.

Close codePreceded byDescription
1000session.closed with reason set to client_request or idle_timeoutThe session ended normally: the client sent session.close, or the session was idle.
1008error, then session.closed with reason set to errorAn error ended the session. Open a new connection to start another session.
1011NothingThe server could not continue the session. Open a new connection to start another session. See Connection failures.
1012session.closed with reason set to server_shutdownThe server is restarting. Open a new connection right away to start another session.

Handshake failures

A handshake with a missing or invalid credential is rejected with 401 Unauthorized, and a handshake from an organization that is not permitted to use the endpoint is rejected with 403 Forbidden. Both are rejected before a WebSocket exists, so no error message can be sent; read the status from your client library’s handshake result. See Authentication.

Connection failures

If the server cannot continue a session, it closes the connection with code 1011 without sending session.closed. Treat a close that was not preceded by session.closed as a lost session and open a new connection.

  1. If the connection drops without a close frame, the session has ended. Client libraries report this as close code 1006. Open a new connection.
  2. A text message that is not valid UTF-8 ends the session with 1011.

Reporting a problem

When contacting Hume, include the identifier of the request or session:

  1. For an upload or run request, the request_id from the response or the error body.
  2. For a realtime session, the session_id from session.created.

Next steps