Subcore AI Docs
Agents API

Errors

One error envelope, and every code the agents API and the config read can answer with.

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
403FORBIDDENOn /agents, the key does not have the manage-agents permission. On the config read, the key's permissions.cores does not reach this agent
429RATE_LIMITEDOver 120 requests a minute on /agents. Wait Retry-After seconds
413PAYLOAD_TOO_LARGEThe request body is over 400 KiB for an agent, or about 1.5 MB for a file. The body is cut off while it is read
400INVALID_JSON, INVALID_BODYThe body is not JSON, or not an object
400UNKNOWN_FIELDThe body carries a field this route does not take: slug, routingKey, or a misspelling
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
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_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
404NOT_FOUNDNo agent with this slug, or none on this routing key, in the organization. An agent in another organization gets the same answer
404FILE_NOT_FOUNDNo file at this path
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_DEPLOYMENTDELETE /agents/{slug} on a core whose kind is deployment. That row is a running service, not an agent this API retires
500DATABASE_ERRORA query failed inside Subcore. Retry; if it persists, report it

Handling them

Retry 429 and 500. Do not retry the other 4xx codes: a 400, 401, 403, 404 or 409 means the request itself needs to change, and sending it again unchanged will fail the same way. On a 429, wait the number of seconds in Retry-After.

Two of the 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.

IS_DEPLOYMENT is not about order, and no sequence of calls gets past it. It means the slug names one of your running deployments rather than an agent, and deleting it here is refused outright. Check kind on the row first.

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.

On this page