Skip to content

Error codes

Every reply of the inference gateway, a success included, carries a status envelope: a code of the form DA-NNNN, its name, a reason (every code but DA-0000 has one), whether the same request may be sent again (retryable), how long to wait first when the gateway says (retry_after_s), a free-text detail, and a trace_id. The client reads it on every get_action(): a success returns the action, and a refusal raises an exception that carries the envelope’s code, reason, retryable and retry_after_s as attributes.

Code Name Meaning
DA-0000 OK The request succeeded; the reply carries the action chunk.
DA-0001 OK_NEW_SESSION The request succeeded on a new session; the reason says why the session is new.
DA-1000 UNAUTHORIZED The API key was refused, so the request was not run.
DA-2000 NO_CAPACITY No model server could take the request right now.
DA-4000 BAD_REQUEST The request itself was rejected; sending it again gets the same answer.
DA-5000 SERVE_FAULT The model server running the checkpoint failed the request.
DA-6000 GATEWAY_FAULT The inference gateway itself failed the request.

The request succeeded; the reply carries the action chunk.

It carries no reason and is not retryable; the client returns the action.

The request succeeded on a new session; the reason says why the session is new.

Reason Retryable The client Meaning What to do
new no returns the action The request carried no session (the first of an episode, or the first after reset_episode()), so the gateway started one. Nothing: the client returns the action and sends the new session with the episode’s next requests.
expired no on an episode’s first request, returns the action; mid-episode, raises DreamSessionExpired The session sent was ended after it sat idle too long, so the gateway started a new one and the model’s memory of the episode starts over. Treat it as the start of a new episode: the client has adopted the new session but does not return the action, so bring the robot to a safe pose and start the task again, or stop. Keep requests flowing while an episode runs.
unknown no on an episode’s first request, returns the action; mid-episode, raises DreamSessionExpired The gateway no longer holds the session sent, so it started a new one and the model’s memory of the episode starts over. Treat it as the start of a new episode: the client has adopted the new session but does not return the action, so bring the robot to a safe pose and start the task again, or stop.
serve_died no on an episode’s first request, returns the action; mid-episode, raises DreamSessionExpired The model server holding the session stopped, so the gateway started a new session on another one and the model’s memory of the episode starts over. Treat it as the start of a new episode: the client has adopted the new session but does not return the action, so bring the robot to a safe pose and start the task again, or stop.

The API key was refused, so the request was not run.

Reason Retryable The client Meaning What to do
missing no raises DreamAuthError The request carried no API key. Pass api_key, or set DREAM_API_KEY in the environment or in ~/.dreamlabs/credentials.
unknown_key no raises DreamAuthError The API key is not one the platform issued; it may be mistyped or cut short. Copy the key again from the platform’s API keys page, whole.
disabled no raises DreamAuthError The API key was revoked, or the account is suspended. Create a new key on the platform, or contact Dream Labs about the account.
over_cap no raises DreamAuthError The account’s spending this month has passed its monthly budget cap, so its API keys are paused. Raise the budget cap on the platform’s Billing page, or wait for the next month; the keys work again within about two minutes.
not_entitled no raises DreamAuthError The account may not run the checkpoint named. Pick a checkpoint that DreamClient.get_models() lists, or contact Dream Labs about access.
region_not_supported no raises DreamAuthError Inference is not offered in the country the request came from yet; the error message names the countries it is offered in. Run from a country it is offered in, or contact Dream Labs.

No model server could take the request right now.

Reason Retryable The client Meaning What to do
pool_full yes raises DreamServerError Dream-1 is at max capacity right now. Wait retry_after_s seconds, then send the same request again.
pool_warming yes raises DreamServerError No model server for this checkpoint is up yet, so one is starting: the first request to a checkpoint, or the first after it sat idle, starts it cold. Wait retry_after_s seconds and send the same request again; keep retrying until a server answers.
rate_limited yes raises DreamServerError The session sent requests faster than the gateway allows for one session. Send requests less often; wait a moment, then send the same request again.
queue_timeout yes raises DreamServerError The request waited too long for its model server to be free, and was dropped. Send the same request again.
max_serves no raises DreamServerError Dream-1 is at max capacity right now, and no more model servers may start for this checkpoint. Sending the same request again at once gets the same answer: try again later, or contact Dream Labs about the limit.

The request itself was rejected; sending it again gets the same answer.

Reason Retryable The client Meaning What to do
malformed no raises DreamBadRequest The request is not one the gateway can read, or its observation does not fit what the checkpoint reads: a camera or state key missing, a state of the wrong width, or frames that do not decode. Fix the observation as the error message says; if the message is about the request itself, upgrade the dream client, and if a current client still gets it, contact Dream Labs with the error message.
too_large no raises DreamBadRequest The request is larger than the gateway accepts; the camera frames are most of it. Send smaller frames: lower the camera resolution or the JPEG quality.
unknown_op no raises DreamBadRequest The request asked for an operation the gateway does not know. The dream client never sends one; upgrade it, or contact Dream Labs if a current client gets this.
invalid_session_id no raises DreamBadRequest The session id sent is not of the form the gateway issues. The dream client sends only the ids the gateway gave it; upgrade it, or contact Dream Labs if a current client gets this.
global_op_rejected no raises DreamBadRequest The request asked to change a setting of the whole model server, which a customer request may not do. The dream client never sends one; upgrade it, or contact Dream Labs if a current client gets this.
unknown_checkpoint no raises DreamBadRequest The gateway does not know the checkpoint named. Use an id that DreamClient.get_models() lists; a fine-tune’s id is its job’s fine_tuned_model, set once the checkpoint is published.
client_outdated no raises DreamBadRequest The dream library that sent the request is older than the oldest major version the inference gateway serves, and such a library is refused rather than run against an API it does not match. Install the current library with your API key, curl -fOJ -H "Authorization: Bearer $DREAM_API_KEY" <platform>/downloads/latest && pip install ./dream-*.whl, where <platform> is the platform your key is from (the error message gives the whole command), then start the run again.

The model server running the checkpoint failed the request.

Reason Retryable The client Meaning What to do
timeout yes raises DreamServerError The model server did not answer in time. Send the same request again.
error yes raises DreamServerError The model server failed while computing the action. Send the same request again; if the same observation fails every time, contact Dream Labs with the error message.
unreachable yes raises DreamServerError The gateway could not reach the model server. Send the same request again.
capacity yes raises DreamServerError The model server refused the session as full: a fault on the Dream Labs side, and Dream Labs is alerted to it. Send the same request again.

The inference gateway itself failed the request.

Reason Retryable The client Meaning What to do
internal yes raises DreamServerError The gateway hit an internal fault. Send the same request again; if it keeps happening, contact Dream Labs with the error message.
store_write_failed yes raises DreamServerError The gateway could not record the session, so it did not run the request. Send the same request again.
cannot_scale yes raises DreamServerError No model server can be started for this checkpoint; for a fine-tune, its weights could not be prepared. Sending the request again tries once more; if it fails again, contact Dream Labs with the checkpoint id and the error message.
service_unavailable yes raises DreamServerError This checkpoint can’t be run right now, so the request was not run. Send the same request again; if it keeps happening, contact Dream Labs with the checkpoint id and the error message.
connection_timed_out yes raises DreamServerError The connection timed out, so the request was not run. Send the same request again; if it keeps happening, contact Dream Labs with the error message.

A refusal the gateway marks retryable is a DreamServerError with retryable set: wait retry_after_s seconds when it is given, then send the same request again. Any other refusal is raised again by the loop below, because the same request would be refused the same way.

import time

import dream


def act(client, attempts=30):
    # client: a dream.DreamClient with its policy open and set_observation() called this episode
    for _ in range(attempts):
        try:
            return client.get_action()
        except dream.DreamServerError as error:
            if not error.retryable:
                raise
            time.sleep(error.retry_after_s or 1.0)
    raise TimeoutError(f"no action after {attempts} attempts")

The embodiment, dataset, fine-tuning and model calls of DreamClient are answered by other services and do not use these codes: a refusal there is a DreamServerError whose code is that service’s own (conflict, not_found, invalid_request, validation), and each method’s Raises section says which it can get.

Everything the client raises derives from DreamError, so except dream.DreamError catches all of it. Most also derive from a builtin, named after them below, so code that catches ValueError, TimeoutError or RuntimeError keeps working.

  • DreamError: Base of every error the client raises; also raised as itself when a client is used wrongly.
    • DreamConfigError (also ValueError): Something the caller passed or configured is wrong; the message says what, and the same call fails again.
      • DreamBadRequest (also DreamServerError): The model refused the request as malformed (DA-4000); never retryable, the request must change.
    • DreamObservationError (also ValueError): An observation that cannot be sent; raised before anything is sent, with the key named in the message.
    • DreamActionError (also ValueError): The model’s reply is not an action the client can return; nothing is returned, and the message names the key.
    • DreamTimeout (also TimeoutError): The model did not answer within timeout_ms (15000 ms unless the config sets it).
    • DreamProtocolError (also RuntimeError): No answer the client could read: the host could not be reached, or what answered is not the Dream API.
    • DreamServerError (also RuntimeError): A refusal, carried with the answer’s code and reason; whether to call again is retryable.
      • DreamAuthError: The API key was refused; never retryable: check the key, or the account, before calling again.
      • DreamSessionExpired: The model replaced the session in the middle of an episode (DA-0001 with a reason other than new).
    • DreamDatasetError (also ValueError): The local checks refused the dataset, and nothing was sent; str(error) is the one line to fix.
    • DreamUploadError (also RuntimeError): An upload that did not finish; str(error) is the one line, and running the upload again retries it.
  • DreamSlowNetworkWarning (also UserWarning): A Python warning, not an error: the inference client’s recent round trips are slow, and the robot’s motion may be less smooth.