Subcore AI Docs
Agents API

Errors

One error envelope, every code the agents API and the config read can answer with, and the refusals from your deployment these pages name.

Every refusal has the same three fields, on both surfaces:

{
  "error": "This API key cannot manage agents: it lacks the manageAgents scope",
  "code": "FORBIDDEN",
  "timestamp": 1789569967913
}
FieldTypeDescription
errorstringA human-readable sentence. Do not match on it; it may be reworded
codestringThe stable machine-readable code. Switch on this
timestampintegerMilliseconds since the Unix epoch, at the moment of the failure

Codes

StatuscodeMeaning
401AUTHENTICATION_ERRORNo key, or an invalid, revoked or expired one
400AUTHENTICATION_ERRORThe Authorization header is not Bearer followed by a key, such as Basic credentials or Bearer alone. Refused before the key is looked up
403FORBIDDENOn /agents, the key does not have the manage-agents permission, or, to start or stop an eval run, the run-evals permission. On the config read, the key's permissions.cores does not reach this agent
429RATE_LIMITEDOver a rate budget on /agents: 120 requests a minute for one agent, or 600 for the key across all of them. scope in the body says which budget ran out, eval-run-start for the run start budget of 10 a minute. Wait Retry-After seconds
413PAYLOAD_TOO_LARGEThe request body is over 400 KiB for an agent, about 1.5 MB for a file, 96 KiB for outcomes, 768 KiB for an eval case, or 4 KiB on the Twilio routes and to start an eval run. The body is cut off while it is read
400INVALID_JSON, INVALID_BODYThe body is not JSON, or not an object. On an eval run start, INVALID_BODY is also a body without exactly one of suite and caseId
400INVALID_CURSOROn the eval lists, a cursor that was edited or belongs to another list
400VALIDATION_ERROROn the eval routes, a limit, status or archived out of range, or a single result read without caseId
400UNKNOWN_FIELDThe body carries a field this route does not take: slug, routingKey, the read-only sessionIdleMinutes, or a misspelling. On PUT /agents/{slug}/outcomes, anything but fallback and rules
400INVALID_SLUGThe slug is not lowercase letters, digits and hyphens (^[a-z0-9-]+$), or is over 100 characters
400INVALID_DIRECTORYThe directory is not ^[a-z0-9][a-z0-9-]*$, or is over 64 characters. On the write and delete routes, an empty ?directory= lands here rather than defaulting to main. The list route never reads the parameter
400INVALID_PATHThe path is neither entries.json nor lowercase [a-z0-9._/-] ending in .md, holds .., or is over 200 characters
400INVALID_NAMEThe name is not a string or null, or holds a NUL character or an unpaired surrogate
400INVALID_INSTRUCTION_SOURCENot repo or database
400INVALID_TIMEZONENot a zone the IANA database knows
400INVALID_PHONE_NUMBER, INVALID_TRANSFER_NUMBERNot E.164. On PUT /agents/{slug}/twilio/number, also a phoneNumber missing from the body
400INVALID_VARIABLESvariables is not an object of name to string, a name is not ^[A-Za-z_][A-Za-z0-9_]*$ within 64 characters, or a value holds a NUL character or an unpaired surrogate
413VARIABLES_TOO_LARGEThe whole variables map is over 64 KiB as the column stores it
400INVALID_MODELmodel is not an id of 1 to 128 letters, digits and . _ : / - starting with a letter or digit, or null
400INVALID_CHANNEL_OVERRIDESchannelOverrides is not a map of channels to { "model", "disabledTools", "enabledTools" }, with an optional voice on the voice entry: a channel outside lowercase letters, digits, _ and - or over 32 characters, an entry with another field, a voice on any other channel, even null, a model that is not an id or null, a voice that is not 1 to 128 printable ASCII characters with no space or null, or more than 64 tools in one list
413CHANNEL_OVERRIDES_TOO_LARGEThe whole channelOverrides map is over 16 KiB as the column stores it
400INVALID_TOOLS_OPT_INtoolsOptIn is not true or false
400INVALID_RECORD_CALLSrecordCalls is not true or false
400MODEL_NOT_OFFEREDPUT /agents/{slug} changes a model, the agent's own or a channel's, to one its deployment does not offer there. Also the answer when the deployment offers nothing, or the agent names none, and the first value the request changes is a model. error names the field, its value and the deployment. Nothing is written
400VOICE_NOT_OFFEREDPUT /agents/{slug} changes the voice entry's voice, or the model beside it, and the voice is not one the engine that model runs on offers: a realtime model's voices, relayVoices beside a relay text model, and beside null or a model the deployment no longer offers, the default engine's, from kit 0.43.0 only. An engine that offers no voices refuses every one. Also the answer when the deployment offers nothing, or the agent names none, and the first value the request changes is a voice. Nothing is written
400INVALID_OUTCOMESPUT /agents/{slug}/outcomes: a list the console could not store. error names the first problem: a fallback or a name that is not 1 to 40 characters once trimmed or holds a NUL character or an unpaired surrogate, more than 30 rules, a rule that is not { "name", "when" }, two names the same ignoring case, or a when that is neither one { "tool": "<tool id>" } or { "event": "transferred" | "voicemail" | "hung_up" | "agent_ended" } nor an { "anyOf": [ … ] } of 1 to 20 of them. Nothing is written
400INVALID_EVAL_CASEAn eval case a rule refuses. field names the field, such as goal or tools.lookup_customer. Nothing is written
400CASE_ID_MISMATCHA PUT whose body slug renames a case that does not exist
400INVALID_IDEMPOTENCY_KEYAn Idempotency-Key on an eval run start that is not 1 to 255 characters
400INVALID_CONTENTThe content is not a string, or holds a NUL character or an unpaired surrogate
413CONTENT_TOO_LARGEThe file is over 256 KiB of UTF-8
400INVALID_ENTRIESentries.json is not an object whose values are prompt paths: lowercase [a-z0-9._/-] ending in .md, with no .. segment
400INVALID_ACCOUNT_SID, INVALID_API_KEY_SIDNot AC or SK followed by 32 hex characters. The hex may be in either case and is stored lowercase. The prefix must be uppercase, and nothing is trimmed
400INVALID_API_KEY_SECRETNot the 32 letters and digits Twilio shows when it creates an API key
400INVALID_AUTH_TOKENNot 32 lowercase hex characters, and not null
400INVALID_DEPLOYMENTA deployment on PUT /agents/{slug} that is not a name of 1 to 255 characters or null, a webhooks body's deployment that is not a non-empty string, or ?deployment= with nothing after it
400TWILIO_REJECTEDTwilio refused the API key, the auth token or the request. Twilio's own error code is in error
404NOT_FOUNDNo agent with this slug, or none on this routing key, in the organization. An agent in another organization gets the same answer, and so does a deployment's retired former agent on every route but PUT /agents/{slug}
404FILE_NOT_FOUNDNo file at this path
404CASE_NOT_FOUNDNo eval case with this id on this agent, or no result for it in the run
404RUN_NOT_FOUNDNo eval run with this id on this agent
409NO_INSTRUCTIONSSwitching an agent to database, or creating one on it, while it has no file stored. The config read answers the same for a database agent with nothing stored
409LAST_INSTRUCTION_FILEDeleting the only file of an agent on database. Switch it to repo first
409IS_DEPLOYMENTDeprecated, and no longer answered. It refused DELETE /agents/{slug} on one of your running deployments. A deployment is no longer an agent, so no slug is one. Listed for one more release
409NOT_CONNECTEDListing numbers, choosing or clearing one, or pointing webhooks, for an agent with no Twilio account connected
409NUMBER_NOT_IN_ACCOUNTThe number is not in the agent's connected Twilio account
409NUMBER_FROM_TWILIOPUT /agents/{slug} tried to change or clear the phoneNumber of an agent with a Twilio account connected. Its number is chosen with PUT /agents/{slug}/twilio/number
409NO_PHONE_NUMBERPointing webhooks for an agent with no phoneNumber
409NUMBER_ROUTED_ELSEWHEREA TwiML App or an Elastic SIP Trunk routes the number, so Twilio would ignore the webhook URLs
409NO_DEPLOYMENTThe deployment a request names (a deployment field, or ?deployment=) is not one of your organization's. Or the agent names none and no deployment serves your agents by routing key. Or, when pointing a number, the chosen deployment serves no agents by routing key. Or, on GET /agents/{slug}/deployment/models, the agent names none and the request names none either. Or, to start an eval run, the agent names none
409AMBIGUOUS_DEPLOYMENTThe agent names no deployment, several serve your agents, and the request names none. Name one, or link the agent with PUT /agents/{slug}
409TWILIO_HOST_UNKNOWNThe deployment has not announced the host Twilio should call, or announced one Twilio cannot reach
409DEPLOYMENT_URL_UNKNOWNReading the agent's deployment: no address is approved for it, or it is not a public https address. Nothing was sent. An operator approves it on the deployment's page in the console
409VARIABLES_NOT_PUBLISHEDGET /agents/{slug}/deployment/variables: the deployment publishes no list of variables, from a kit before 0.21.3 or with no description at all. kitVersion in the body is its kit, or null
409PROMPTS_NOT_PUBLISHEDGET /agents/{slug}/deployment/prompts: the deployment publishes no prompt files with a storagePath, from a kit before 0.23.0 or with no description at all. kitVersion in the body is its kit, or null
409CASE_ID_TAKENRenaming an eval case onto an id the agent already has
409CASE_ID_LOCKEDRenaming an eval case that has results, or that a running run holds. reason is has_results or in_running_run
409SUITE_FULLThe case's suite already holds 50 cases, archived ones included
409CASE_ARCHIVED, NO_CASES, TOO_MANY_CASESAn eval run of an archived case, of a suite with no live case, or of one with more than 50 (count)
409EVAL_LIVE_NOT_ALLOWEDAn eval run whose cases answer a tool live that the deployment does not let run live on that case's channel, or on a channel the agent does not run. cases lists them. Nothing started
409EVALS_UNAVAILABLEAn eval run on an agent whose deployment does not advertise the eval door (kit 0.44.0), or has no approved address
409RUN_IN_PROGRESSAnother eval run of this agent is going. runId names it, or is null when it ended in between
409RUN_FINISHED, RUN_NOT_STOPPABLEStopping a run that completed without a stop, or one a local bun run evals reported
409IDEMPOTENCY_KEY_REUSEDThe Idempotency-Key already started a different run: another agent, another body, or another API key
409CHANGED_DURING_CHECKThe agent's number or Twilio account changed while the request was checking or writing the other. Retry
500DATABASE_ERRORA query failed inside Subcore. Retry; if it persists, report it
503CONSOLE_UNAVAILABLEAn eval case write or an eval run start or stop could not be completed by the Subcore console, which holds their rules. With retryable: true the console's answer could not be read, so the write may have happened: read it back before retrying. With false nothing was written, and retrying changes nothing until Subcore is fixed, such as a console not serving the route yet
503RUN_NOT_STARTEDAn eval run was written and then could not start. It is kept as a failed run, runId names it, and its Idempotency-Key is released, so a retry starts a new run
503TWILIO_UNAVAILABLETwilio did not answer in time, answered with a 5xx or a 429, or took over 25 seconds to list the account. Retry. The same code answers an account too large to list, with over 20,000 numbers or Messaging Services, which a retry does not fix; error says which
503DEPLOYMENT_UNAVAILABLEReading the agent's deployment failed. retryable in the body is true when the failure can pass: the deployment timed out, could not be reached, or answered with a 5xx or a 429. Retry after at least 10 seconds. It is false when asking again gets the same answer until the deployment or Subcore changes, Subcore being unable to sign the request included; report it

Handling them

Always retry 429, 500 and 409 CHANGED_DURING_CHECK. Retry 503 DEPLOYMENT_UNAVAILABLE and 503 CONSOLE_UNAVAILABLE only when their retryable is true, and retry 503 RUN_NOT_STARTED. Retry an eval run start with the same Idempotency-Key, so a start that did happen is returned rather than repeated. Retry 503 TWILIO_UNAVAILABLE unless its error says the account is too large to list. Retry 409 RUN_IN_PROGRESS once the agent's run has ended: poll the run its runId names, or, when runId is null, simply try again. Do not retry the other 4xx codes: a 400, 401, 403, 404 or any other 409 means the request itself, or something it depends on such as your client's Twilio setup, has to change first, and sending it again unchanged will fail the same way. On a 429, wait the number of seconds in Retry-After.

The Twilio codes are set out where they arise, with what to do about each, on Twilio accounts.

Two of the instruction 409s are about order. NO_INSTRUCTIONS means write a file first, then switch. LAST_INSTRUCTION_FILE means switch the agent to repo first, then delete. See the two guards.

MODEL_NOT_OFFERED and VOICE_NOT_OFFERED are checked against the copy of the deployment's description the console keeps. If a deploy has just added the model or voice you asked for, or moved the deployment to kit 0.43.0, have the console read the deployment again, by opening it under Deployments, then send the PUT again. See checked against the deployment's offer.

AMBIGUOUS_DEPLOYMENT goes away for good once the agent names its deployment: send { "deployment": "<name>" } on PUT /agents/{slug}, and every later request for that agent dials it without being told.

Switch on code, not on error. The sentences are written for a person reading a log and are not part of the contract.

A 404 NOT_FOUND never confirms an agent across organizations. A slug or routing key that exists in another organization gets the same answer as one that exists nowhere, so a 404 on an agent you expected to find usually means the key and the agent belong to different organizations.

Refusals from your deployment

Every code above comes from api.subcore.ai. Your deployment's own routes answer with codes the kit documents. These follow from what these pages cover:

StatuscodeMeaning
404routing_key_requiredA text door or the Playground was asked on its bare path, without {tenantPath}, from kit 0.31.0, and the eval door from kit 0.44.0. error names the path to use
404conversations_withheldOne of the console's conversation routes, to read a conversation or take one over, on a deployment whose TELEMETRY_PROFILE is anything but full or unset, from kit 0.34.0. It is checked after the console's credential and before any lookup, so it says nothing about whether the conversation exists
400eval_live_not_allowedAn eval turn asked to run a tool for real that may only be mocked on that deployment, from kit 0.44.0. tools in the body lists them. The turn did not run
429eval_busyThe instance already runs as many eval turns as it allows, 2, from kit 0.44.0. Wait Retry-After seconds
200eval_tools_unguardedNot a refusal before the stream: the last line of an eval turn, an error line with this code, from kit 0.44.0. An agent the project's createSessionCore0 built for that turn can reach a tool the kit did not hand it as config.tools (a tool wrapped again with a new execute, say, or the loadSkill tool core0 adds for skills), or has mcpServers. From kit 0.47.0, a project's turn runner ends the turn this way too, before its turn runs, when an Effect tool of its session's flows or a tool in its tools did not come from session.wrapTool, when one carries a voice lifecycle tool's id but wraps a tool of your own, or when the session returns neither list (step 2 says what the kit cannot see). message names the tools, any agent with MCP servers, and the turn runner's cause. No tool ran

Each body has error and code but no timestamp. conversations_withheld adds detail, and eval_live_not_allowed adds tools. The eval_tools_unguarded line carries message and code instead. Retry only eval_busy, after Retry-After. The others give the same answer until the request or the deployment changes: send the routing-key path, run full, list the tool in the project's evals.liveToolIds, or build every agent from config.tools, with no tool given a new execute and no skills or mcpServers. A turn runner's fix is to wrap every tool its session declares, leave each lifecycle id to the tool channelTools wires for it, and return flows or tools.

On this page