Error codes

Every failure has a stable code, the same in Python, TypeScript, Rust and the gateway, so code that checks codes works everywhere. Codes may be added; before 1.0 none is renamed or removed.

from criogenai import CriogenError, ThreadBusyError

try:
    await chat.send("Hello")
except ThreadBusyError:
    ...                      # another run holds the thread
except CriogenError as error:
    print(error.code, error.message, error.details)
import { isCriogenError } from "criogenai";

try {
  await chat.send("Hello");
} catch (error) {
  if (isCriogenError(error, "thread_busy")) { /* … */ }
}

In Rust, RunError::kind.code(), AgentError::code, StorageError::code() and ModelErrorKind::code() give the same strings.

Run errors#

CodeMeaningRetry?SDK class
node_failedA workflow node returned an error.noCriogenError
node_panickedA Rust node panicked; the run failed instead of the process.noCriogenError
node_timeoutA node attempt took longer than its policy timeout.yesCriogenError
router_failedA router function returned an error.noCriogenError
unknown_routeA router returned a label with no edge.noCriogenError
missing_gotoA node that must choose the next node did not.noCriogenError
memo_type_mismatchA saved task memo entry does not have the shape the node asks for (or a value to save is not JSON); seen as the kind of a node_failed error.noCriogenError
update_conflictTwo nodes wrote the same state key in one step without a reducer.noCriogenError
step_limit_exceededThe run reached its step limit.noLimitExceededError
deadline_exceededThe run reached its deadline, or the next retry would pass it.noLimitExceededError
cancelledThe run was cancelled (a cancel token, an AbortSignal, a dropped stream, an interrupt from another process). In a tool message: a call that never got a result.yesCancelledError
invalid_valueA value was not accepted: a state write a reducer cannot apply, a memory key, value, namespace or vector, a configuration value.noValidationError
resume_invalidA resume or approval decision does not match what the run waits for.noValidationError
workflow_mismatchA snapshot was made by a different workflow.noValidationError
storage_failedSaving the run's progress failed; details carry the storage code.yesStorageError
model_failedA model call failed after retries and fallbacks; details.model_error has the kind, and retryable follows it.dependsModelError
tool_failedA tool failed with an error it did not handle (an exception, a panic). By default the model sees it as the call's result and the run goes on; with on_tool_exception="fail" (or ToolError::fatal) it fails the run.noToolExecutionError
limit_exceededA model-call, tool-call, token or nesting limit was reached; details.limit names it.noLimitExceededError
output_invalidThe structured output was still invalid after the allowed retries.noCriogenError
hook_failedA hook returned an error.noCriogenError
invalid_stateThe run state is not an agent's, or memory cannot find the run's namespace.noValidationError
invalid_inputThe input names one of the agent's own state keys, or tries to change the value that scopes the thread's memory.noValidationError
audit_failedAn audit record could not be written, so the action it describes failed.yesStorageError

Thread errors#

CodeMeaningRetry?SDK class
thread_busyAnother run holds the thread (OnBusy reject, or the wait timed out).yesThreadBusyError
thread_suspendedThe thread waits for approval: answer it before sending more.noThreadSuspendedError
thread_interruptedThe thread's last run did not finish: continue it with retry.noCriogenError

Storage errors#

CodeMeaningRetry?SDK class
invalid_valueA value was not accepted: a state write a reducer cannot apply, a memory key, value, namespace or vector, a configuration value.noValidationError
audit_failedAn audit record could not be written, so the action it describes failed.yesStorageError
thread_busyAnother run holds the thread (OnBusy reject, or the wait timed out).yesThreadBusyError
storage_unavailableThe database could not be reached or timed out.yesStorageError
storage_conflictAnother writer changed the thread first.yesStorageError
checkpoint_not_foundNo checkpoint with that id.noStorageError
storage_corruptStored data could not be read.noStorageError
storage_incompatibleThe database was written by a newer schema version.noStorageError
encryption_key_missingEncrypted data, or an encrypted database, without the key to read it.noStorageError
encryption_key_invalidA key does not match the one the database knows under its id.noStorageError

Model errors (inside model_failed)#

CodeMeaningRetry?SDK classHTTP
rate_limitedThe provider asked us to slow down.yes–429
overloadedThe provider is overloaded.yes–503
serverThe provider failed (5xx).yes–502
timeoutNo answer in time: a model call, or (in a tool message) a tool call.yes–504
networkThe connection failed or broke.yes–502
authThe provider refused the API key.no–502
permissionThe key may not use this model or feature.no–502
not_foundThe provider does not know the model or endpoint.no–502
invalid_requestThe provider (or the gateway) rejected the request as malformed.no–400
context_overflowThe conversation is longer than the model's context.no–400
content_filterThe provider's safety system refused the request.no–400
quota_exhaustedBilling or quota is exhausted; another provider may still answer.no–502
invalid_responseA successful response whose body could not be read (already billed, so not retried).no–502
unknownAn unclassified provider failure.no–502

Tool results (the model sees these; the run goes on)#

CodeMeaningRetry?SDK class
cancelledThe run was cancelled (a cancel token, an AbortSignal, a dropped stream, an interrupt from another process). In a tool message: a call that never got a result.yesCancelledError
tool_failedA tool failed with an error it did not handle (an exception, a panic). By default the model sees it as the call's result and the run goes on; with on_tool_exception="fail" (or ToolError::fatal) it fails the run.noToolExecutionError
timeoutNo answer in time: a model call, or (in a tool message) a tool call.yes–
invalid_argumentsThe model's arguments did not match the tool's schema; the model sees the problems and may correct them.no–
unknown_toolThe model called a tool the agent does not have.no–
tool_errorThe tool reported a failure meant for the model (ToolError).no–

Build errors#

CodeMeaningRetry?SDK class
invalid_agentAn SDK agent configuration the engine could not build.noValidationError
invalid_workflowAn SDK workflow that does not validate (`details.issues` lists the problems).noValidationError
unsupportedThe feature needs a server, and here the engine runs as WebAssembly in a JavaScript host (the browser, design 0021): databases (SQLite, Postgres), encryption at rest, telemetry export, web tools.noCriogenError
mcp_connectAn MCP server could not be started or reached, or refused the credentials (design 0022).noCriogenError
mcp_protocolAn MCP server answered something the client cannot use: a malformed message, an error, or a protocol version CriogenAI does not speak.noCriogenError
mcp_tool_nameTwo of an MCP server's tools map to the same name, or a name maps to nothing: set a prefix or leave one out with `except`.noCriogenError
mcp_tool_schemaAn MCP tool's input schema is not an object schema, or is too large or too deep: leave the tool out with `except`.noCriogenError
mcp_timeoutAn MCP server was not ready within the connect timeout.yesCriogenError
mcp_closedThe MCP server stopped (its process exited) or the client was closed.noCriogenError
eval_failedAn eval missed a bar set by `check` (design 0024): a pass rate, a scorer's mean, or a regression against the baseline; `details.failures` lists them.noCriogenError

Gateway errors (HTTP)#

CodeMeaningRetry?SDK classHTTP
invalid_requestThe provider (or the gateway) rejected the request as malformed.no–400
invalid_api_keyThe gateway needs a valid virtual key.no–401
model_not_foundNo route by that name, or the key may not use it.no–404
key_rate_limitedThe key's requests or tokens per minute are used up; Retry-After says when to try again.yes–429
concurrency_limitedToo many requests are in flight, over the gateway or for this key; Retry-After says when to retry.yes–429
budget_exceededThe key's token budget is spent for the current day or month (Retry-After: until it ends), or in total.no–429