OpenLegion · Docsllms.txt
Docs pages

Errors

Every error has a stable code: it is the contract your code switches on. This page has one entry per code, and every error's doc_url is this page with the code as its anchor, e.g. /docs/errors#parameter_missing.

A code appears in one or more of three places:

  • An error response: { "error": { "type", "code", "param", "message", "doc_url", "request_id" } }. type fixes the HTTP status family, and param names the field at fault, or is null. A refusal also has partner_message. A cap_reached refusal that knows which limit refused also has limit: { "cap", "why", "resets_at" } (see cap_reached).
  • A run's error: a run that ended in an error.
  • An action's error: a tool call the agent made that didn't happen, or failed.

A refusal, a run's error and an action's error each carry two sentences. message is for your end user and never names OpenLegion or your setup; partner_message is for you: what happened, and what to do. Show the first, log the second. A session token's responses (POST /sessions) leave partner_message out: that token is your end user's own credential.

If you mount the SDK's handler on your server, its routes answer a few codes of their own: they're at the end, under Kit routes, on your server.

Responses: invalid_request_error

The request itself is wrong: a parameter, the body or a header. HTTP 400, 405, 410, 413, 422.

parameter_missing

A required parameter is missing.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Send it: param names it.

parameter_invalid

A parameter's value is not valid.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Fix the value param names; the message says what is wrong with it.

parameter_unknown

The request has a parameter this route doesn't take.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Remove it, or check its spelling against the API reference.

parameter_unsupported

The contract names this parameter, but this route doesn't support it yet.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Leave it out; the message says what the route takes instead.

body_invalid

The body could not be read, or is not valid JSON.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Send a JSON object with content-type: application/json.

body_too_large

The body is larger than this route takes.

  • Where: an error response (invalid_request_error, HTTP 413).
  • Next: Send less: the message gives the limit.

method_not_allowed

This route doesn't take that HTTP method.

  • Where: an error response (invalid_request_error, HTTP 405).
  • Next: Use a method the allow header lists.

version_unsupported

The OpenLegion-Version header names a version this API doesn't serve.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Send a supported version (the message lists them), or leave the header out for your key's default.

url_invalid

A URL is not valid: not https, malformed, or too long.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Send an https URL of at most 2048 characters.

url_unsafe

The URL resolves to a private, local or otherwise unsafe address.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Use a public https URL. For a server on your machine, use npx openlegion dev (a dev connector) instead.

idempotency_key_invalid

The Idempotency-Key header is not valid.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Send 1–255 printable characters with no spaces.

idempotency_key_reused

This Idempotency-Key was already used for a different request.

  • Where: an error response (invalid_request_error, HTTP 422).
  • Next: Use a new key for a new request; reuse a key only to retry the same request.

computer_session_ended

The agent's browser session has ended, so there is nothing to watch or take over.

  • Where: an error response (invalid_request_error, HTTP 410).
  • Next: Don't retry. A later run opens a new session, with its own data-computer part.

workspace_required

The route needs a workspace, and none was named.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Send OpenLegion-Workspace: ws_… with an org key, or use a session token.

subject_required

This is one person's decision or view (an approval, their seen marks, their summary of agents, the agent's browser in their conversation), and no person was named.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Send OpenLegion-Subject with your user's id, or use that user's session.

console_read_only

The console reads the API through GET operations only.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Make the change with an org key from your server.

confirm_mismatch

The console's Erase was confirmed with something other than the workspace's customer id.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Type the workspace's customer id exactly as shown.

test_mode_only

This exists in test mode only.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Use a test key (olp_test_…).

live_mode_only

This is a live-mode setting.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Use a live key (olp_live_…).

vault_secret_required

The vault item needs a secret value.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Send the secret with the item.

model_key_model_missing

The key wasn't saved: it can't use a model this workspace's agents run on. The message names each model and tier.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: The person gives the key access to those models with the vendor, or saves another key.

model_key_malformed

The key wasn't saved: it isn't shaped like the vendor's API key (too short, not a key, or the other vendor's). It was never sent to the vendor.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: The message says which. The person copies the whole key again, for the vendor chosen.

model_key_invalid

The key wasn't saved: the vendor refused it.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: The person checks the key with the vendor (it may be revoked or deleted), or makes a new one.

template_has_no_version

The template has no version yet.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Create one (POST /templates/{slug}/versions, or npx openlegion templates push).

promote_too_large

Too many workspaces track this template to promote in one go.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Pin some workspaces to their version, or contact OpenLegion.

connector_missing

A template version uses a connector that no longer exists in this mode.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Publish a version without it, or create the connector again.

app_needs_oauth_app

The app admits only a registered OAuth app, and none is registered for it yet, so no connect session can open for it (POST /connect_sessions).

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Pick another app from GET /connector_catalog, or ask OpenLegion when this one will be available.

app_not_enabled

The workspace's template version does not list the app in its apps, so no connect session can open for it (POST /connect_sessions).

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Publish a version that lists the app in apps and move the workspace to it, or pick one of the apps the error names.

connector_auth_rejected

Your server refused OpenLegion's signed request.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Set the connector's secret on your server and verify OpenLegion-Signature (the kit does), then try again.

template_route_missing

OpenLegion found no template route beside your connector's /mcp route, or got a redirect there.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Update @openlegion/platform (its handler serves {basePath}/template), and point the connector at {basePath}/mcp with no redirect in between.

template_answer_invalid

Your server's template route answered, but not with a template definition OpenLegion accepts.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Run npx openlegion dev: it shows what your agent's definition fails on. Fix it, then try again.

authorization_pending

The sign-in code hasn't been approved yet.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Poll again after the interval.

slow_down

The sign-in poll is too fast.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Wait the interval the message gives between polls.

access_denied

The sign-in was denied, or whoever approved it can no longer.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Run npx openlegion login again.

expired_token

The sign-in code expired before it was approved.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Run npx openlegion login again.

device_code_invalid

The device code isn't valid, or was already used.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Run npx openlegion login again.

code_not_retyped

Approving live keys needs the code typed a second time, and it was missing or didn't match.

  • Where: an error response (invalid_request_error, HTTP 400).
  • Next: Type the code from your terminal again, in the second box.

Responses: authentication_error

The request's key is missing, or isn't one OpenLegion accepts. HTTP 401.

api_key_missing

No key was sent.

  • Where: an error response (authentication_error, HTTP 401).
  • Next: Send an org key: Authorization: Bearer olp_test_… or olp_live_….

api_key_invalid

The key is not valid.

  • Where: an error response (authentication_error, HTTP 401).
  • Next: Check it was copied whole; create a new one in the console if it was lost.

api_key_revoked

The key was revoked.

  • Where: an error response (authentication_error, HTTP 401).
  • Next: Use another key, or create one in the console.

api_key_expired

The key has expired: a rotated key stops working when its overlap window ends.

  • Where: an error response (authentication_error, HTTP 401).
  • Next: Use the key that replaced it.

session_invalid

The session token is not valid.

  • Where: an error response (authentication_error, HTTP 401).
  • Next: Ask your server for a new one (POST /sessions).

session_expired

The session token has expired.

  • Where: an error response (authentication_error, HTTP 401).
  • Next: Ask your server for a new one (POST /sessions).

Responses: permission_error

The key is valid, but it may not do this. HTTP 403.

insufficient_scope

The key doesn't have the scope this route needs.

  • Where: an error response (permission_error, HTTP 403).
  • Next: Use a key with that scope (the message names it); an org owner or admin can create one in the console.

session_not_allowed

A session token can't call this route: it takes an org key only. The token itself is fine; it is never a 401.

  • Where: an error response (permission_error, HTTP 403).
  • Next: Call it from your server with an org key.

insufficient_role

The person acting doesn't have the role this needs in the workspace.

  • Where: an error response (permission_error, HTTP 403).
  • Next: Act as an owner or admin of the workspace (the message says which role).

org_role_required

This needs a higher role in the organization.

  • Where: an error response (permission_error, HTTP 403).
  • Next: Ask an organization owner or admin to do it, or to give you that role.

org_suspended

The organization is suspended.

  • Where: an error response (permission_error, HTTP 403).
  • Next: Contact OpenLegion support.

livemode_not_approved

The organization isn't approved for live mode yet.

  • Where: an error response (permission_error, HTTP 403).
  • Next: Use test mode until OpenLegion approves live mode for it.

policy_denied

A policy didn't allow this: the organization's, or the agent's own tool policy for an action.

  • Where: an error response (permission_error, HTTP 403); an action's error.
  • Next: If it should be allowed, change the policy (for an action, the template's tool policy).

key_not_revealable

This key can't be shown again: live keys are shown once, when they are created.

  • Where: an error response (permission_error, HTTP 403).
  • Next: Rotate the key to get a new one.

org_creation_invite_only

Partner organizations are invite-only for now.

  • Where: an error response (permission_error, HTTP 403).
  • Next: Ask OpenLegion for access.

Responses: not_found_error

The object doesn't exist, or this key can't see it. HTTP 400, 404.

resource_missing

No such object in this organization and mode: a wrong id, another org's id, or the other mode's id all read the same.

  • Where: an error response (not_found_error, HTTP 404 or 400).
  • Next: Check the id and that your key's mode (test or live) is the object's.

Responses: conflict_error

The request conflicts with the object's current state. HTTP 409.

approval_not_decidable

This approval can only be decided where it was sent (its single-use token didn't match).

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Decide it from the place it was sent to (the card, the console or the channel), or read it again for a fresh one.

schedule_template_owned

The schedule is the workspace template's own: it can be paused and resumed, not edited or cancelled.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Pause it (POST /schedules/{id}/pause), or publish a template version without it.

schedule_agent_owned

The agent made this schedule, so its words are the agent's: it can be paused, resumed or cancelled, not edited.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Cancel it (DELETE /schedules/{id}) and create one of your own (POST /schedules).

idempotency_in_flight

A request with this Idempotency-Key is still being processed.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Retry shortly with the same key: you'll get its result.

request_conflict

Another request is changing the same thing right now.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Retry in a moment.

resource_already_exists

An object with this identifier already exists.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Use it, or choose another slug.

resource_conflict

The change conflicts with the object's current state.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Read the object again, then retry with what it now holds.

invalid_state

The object's current state doesn't allow this change.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Read it, and do what its status allows (the message says what).

key_limit_reached

The organization holds the most active keys a mode may.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Revoke one first.

key_not_active

The key is no longer active, so there is nothing to rotate.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Create a new key instead.

key_revoked

The key was revoked; there is nothing to reveal.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Create a new key.

org_create_busy

Another organization is being created for you right now.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Try again in a moment.

org_limit_reached

You've created the most organizations allowed for now.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Ask OpenLegion if you need more.

org_admin_required

Only an admin or owner of the organization can change its team, and you aren't one (or are no longer a member).

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Ask an owner or admin to make the change, or to give you the admin role.

org_owner_required

Only an owner can make someone an admin or owner, or change or remove an admin or owner.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Ask an owner of the organization to make the change.

org_member_exists

That email address is already a member of the organization.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Change their role on the Team tab instead of inviting them.

org_last_owner

This is the organization's only owner, so they can't be removed or given another role.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Make someone else an owner first, then try again.

org_live_not_ready

The Go live checklist isn't complete, so live mode can't be requested yet.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Finish every required item on the Go live page, then request live access again.

org_live_approved

Live mode is already on for this organization.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Nothing to request: create a live key on the Keys tab.

run_not_cancellable

The run can't be stopped now: it has already ended, or it is settling its last action.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Nothing to stop. Read the run for how it ended.

memory_busy

The agent is consolidating what it learned.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Retry in a minute.

memory_changed

The agent's memory changed while this ran.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Read it again, then retry.

memory_item_not_forgettable

A core block can't be forgotten.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Edit it, or reset the agent's memory to put it back as the template wrote it.

browser_site_template_owned

This website is one the template gives the agent, so it can't be removed here.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Change the template's browser.open sites, then publish and promote the version.

vault_item_exists

A vault item with this name already exists in the workspace.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Use another name, or update the existing item.

vault_item_unreadable

The vault item can't be read: its key is no longer available.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Set its secret again.

subject_busy

Another data-rights request for this user is in flight.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Retry in a moment.

workspace_busy

Another write to the workspace (a run's charge, a top-up of its credits, an agent being paused or resumed) hadn't finished, so the erase stopped and erased nothing.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Retry in a moment.

subject_erasing

This user is being erased, so they can't act.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Wait until DELETE /subjects/{subject} finishes; if it stopped part-way, send it again.

template_agent_not_deletable

Only an agent made with POST /agents can be deleted; this one is the workspace template's own.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Pause it instead (POST /agents/{id}/pause), or publish a template version without it.

template_agent_in_use

A version removes a template agent that agents end users created still follow, so nothing was applied (promote or re-pin).

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Keep that agent in the version, or delete those agents first (DELETE /agents/{id}); the message lists the workspaces.

connector_slug_taken

Some workspaces already have their own connection with this connector's slug, so it can't be granted.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Remove or rename those connections (the message lists them), then try again.

connection_revoked

The connection was disconnected (revoked): it can't be changed (POST /connections/{id}), and an agent's action that needed its account was refused.

  • Where: an error response (conflict_error, HTTP 409); an action's error.
  • Next: Connect the account again through Connect (POST /connect_sessions) for a new connection; connecting it in the dashboard doesn't give its agents access back.

connection_cannot_expire

The connection has no sign-in to expire (it uses a key, or no sign-in at all), so it never needs reconnecting.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: To walk your reconnect flow in test mode, expire a connection to an app your user signs in to (POST /connections/{id}/expire).

custom_server_limit_reached

The workspace already has 10 MCP servers added by their address, the most it may, so no connect session can open for another (POST /connect_sessions), and a session that would finish as the 11th ends failed with this code.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Disconnect one of the workspace's custom servers first (DELETE /connections/{id}). Connecting an address the workspace already has takes no new place.

connector_changed

Your server's tools changed since they were pinned.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Run npx openlegion connectors pin <slug> --dry-run to see what changed, then pin.

webhook_endpoint_disabled

The webhook endpoint is disabled.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Re-enable it (disabled: false), then test it.

webhook_endpoint_limit_reached

The organization has the most webhook endpoints a mode may.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Delete one first.

webhook_delivery_pending

The delivery is still being attempted, so it can't be resent yet.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Wait until it has succeeded or failed (GET /webhook_endpoints/{id}/deliveries shows it), then resend it.

device_login_gone

This sign-in code was already approved or denied, or it expired.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Run npx openlegion login again for a new one.

device_login_void

The key that asked for this sign-in was revoked or has expired, so the request is void and nothing was made.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Ask again with a working key.

live_grant_pending

A live approval for this project is already open: waiting to be approved, or approved and not yet collected by its terminal.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Let it finish, deny it, or let it expire (10 minutes).

deploy_plan_changed

The deployment's keys changed since the approval page showed them, so nothing was made and no key was replaced.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Look the code up again on the page, or run npx openlegion deploy --live again, to see what approving does now.

dev_session_limit_reached

The organization has the most dev sessions (npx openlegion dev) connected at once.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Stop one (Ctrl-C in its terminal, or DELETE /dev_sessions/{id}) first.

dev_session_superseded

Another dev session (npx openlegion dev) took this session's connector or endpoint over.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Nothing to fix: one dev session at a time holds a connector. Stop the other to use this one.

dev_request_answered

This relayed request was already answered.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Nothing to do.

dev_request_expired

The relayed request's caller stopped waiting, so the answer wasn't taken.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: If your app answered after the deadline, make it answer within it (20 s for a tool call, 5 s for a webhook).

no_saved_card

Auto-reload needs a saved card.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: An admin saves one, with consent, on a live card top-up in the org console.

The auto-reload amount is above what the saved card's consent covers.

  • Where: an error response (conflict_error, HTTP 409).
  • Next: Lower the amount, or save the card again with consent for it.

Responses: refusal

The request was valid, but a limit, a cap, a pause or a policy said no. HTTP 402, 409.

cap_reached

A limit was reached: the workspace's period or daily cap, the agent's own daily limit, or the organization's agent limit. When it knows which, the error has limit: { cap: daily | period | agent_daily, why: used_up | too_small, resets_at }. used_up: nothing is left of it; too_small: something is left, but less than one run may need. message says the same to your end user, with the reset in the workspace's time zone; word resets_at in your end user's own zone if you show your own. On an action: the workspace used its limit for that tool (web searches, emails, or sandbox time) or its daily or period credit cap had too little left for the action's price, so the call didn't run and nothing was charged; the action's error has no limit object.

  • Where: an error response (refusal, HTTP 402 or 409); a run's error; an action's error.
  • Next: Raise the workspace's limits (POST /workspaces/{id}/limits), grant it credits, or wait for resets_at. The partner_message names which cap and by how much. On an action, the partner_message names the limit and when it resets (a tool's daily limit at 00:00 UTC), or which credit cap to raise.

credits_exhausted

The organization's credit pool can't fund this: a run, a grant, or an unpaid live platform fee the pool couldn't cover.

  • Where: an error response (refusal, HTTP 402); a run's error; an action's error.
  • Next: Live mode: top up the pool in the console (or turn on auto-reload), then try again. Test mode has no top-up: its credits come from the billing account's monthly test allowance, which renews at 00:00 UTC on the 1st; until then, lower budget.run_credits. The partner_message says which. On an action: a paid action (a web search, for example) whose price the pool couldn't hold didn't run, and nothing was charged.

workspace_suspended

The workspace is suspended, so it takes no new work.

  • Where: an error response (refusal, HTTP 409); a run's error.
  • Next: Resume it (POST /workspaces/{id}/resume). When OpenLegion suspended it, the partner_message says: "OpenLegion suspended this workspace, so it can't be resumed from your console or the API. Contact OpenLegion support."

workspace_archived

The workspace is archived, so it takes no new work.

  • Where: an error response (refusal, HTTP 409); a run's error.
  • Next: Restore it first (POST /workspaces/{id}/restore).

agent_paused

The agent is paused (by you, or automatically), so it takes no new work.

  • Where: an error response (refusal, HTTP 409); a run's error.
  • Next: Resume the agent, then send the work again.

entitlement_denied

Your plan doesn't include this: a limit, a feature or a count above what it allows.

  • Where: an error response (refusal, HTTP 409).
  • Next: The partner_message names what. Ask OpenLegion about a plan that includes it, or stay within it.

approval_not_pending

This approval was already decided.

  • Where: an error response (refusal, HTTP 409).
  • Next: Nothing to do: read the approval to see its decision.

approval_expired

The approval expired before anyone decided it, so its action did not run.

  • Where: an error response (refusal, HTTP 409); an action's error.
  • Next: The person can ask the agent again; a new approval is made if it still needs one.

outside_template_bounds

An end customer's change to an agent or a schedule is outside what the template's customizable allows (POST /agents/{id}, POST /schedules); nothing was written.

  • Where: an error response (refusal, HTTP 409).
  • Next: param names the field. Send a value inside the bounds, or widen customizable in a new template version.

agent_limit_reached

The workspace has made as many agents with POST /agents as its template's customizable.agents.max allows.

  • Where: an error response (refusal, HTTP 409).
  • Next: Delete one (DELETE /agents/{id}), or raise customizable.agents.max in a new template version.

schedule_limit_reached

The agent has as many unfinished schedules as its template's customizable.schedules.max allows, whoever made them: a person's, the template's and the agent's own count alike.

  • Where: an error response (refusal, HTTP 409).
  • Next: Cancel one (DELETE /schedules/{id}), or raise customizable.schedules.max in a new template version.

action_changed

The action_hash sent with a decision is not this action's: the action shown is not the action that would run.

  • Where: an error response (refusal, HTTP 409).
  • Next: Read the approval again (GET /approvals/{id}) and decide what it shows, sending its action_hash.

vault_item_limit_reached

The workspace holds the most vault items it may.

  • Where: an error response (refusal, HTTP 409).
  • Next: Delete one first.

model_keys_not_allowed

This workspace may not use a person's own model key: model_keys_allowed is off.

  • Where: an error response (refusal, HTTP 409).
  • Next: Turn it on with POST /workspaces/{id} {model_keys_allowed: true}, or don't offer the setting to this customer.

Responses: rate_limit_error

Too many requests. HTTP 429.

rate_limited

Too many requests.

  • Where: an error response (rate_limit_error, HTTP 429).
  • Next: Wait for retry-after seconds, then retry.

vault_writes_exceeded

The workspace made the most vault changes it may in an hour.

  • Where: an error response (rate_limit_error, HTTP 429).
  • Next: Try again later.

model_key_checks_exceeded

The workspace checked the most model keys it may in an hour.

  • Where: an error response (rate_limit_error, HTTP 429).
  • Next: Try again later (Retry-After).

Responses: api_error

A fault on OpenLegion's side. The response names nothing internal. HTTP 500, 502, 503.

internal_error

Something went wrong on OpenLegion's side.

  • Where: an error response (api_error, HTTP 500).
  • Next: Retry; with an Idempotency-Key a retry is safe. If it repeats, contact support with the request_id.

model_key_unchecked

The vendor didn't answer in time, so the key wasn't checked or saved.

  • Where: an error response (api_error, HTTP 503).
  • Next: Try again in a minute (Retry-After).

subject_erase_incomplete

The erase stopped part-way.

  • Where: an error response (api_error, HTTP 500).
  • Next: Send the same request again: it carries on from where it stopped.

connect_failed

OpenLegion could not connect the app's server just now (it did not answer, or its tools did not pass the safety check), so the connection wasn't made.

  • Where: an error response (api_error, HTTP 502).
  • Next: Try again in a minute; the message says when another app is the better choice.

connector_unreachable

OpenLegion couldn't reach your server, or list its tools.

  • Where: an error response (api_error, HTTP 502).
  • Next: Check the URL and that the server is up, then try again.

connectors_unavailable

Connectors aren't set up on this deployment of OpenLegion.

  • Where: an error response (api_error, HTTP 503).
  • Next: Contact OpenLegion support.

live_keys_need_mail

This deployment can't send the email every live grant sends to the organization's owners and admins, so live keys can't be made from the CLI.

  • Where: an error response (api_error, HTTP 503).
  • Next: Make the live keys on the console's Keys page.

Runs

A run that ended in an error carries one of these as its error.code (and so does the stream's refusal part).

run_budget_exhausted

The run used the whole budget it was given, so it stopped before it finished.

  • Where: a run's error.
  • Next: Raise the template's budget.run_credits if runs need more; the person can send another message to continue.

run_failed

The run stopped on an error on OpenLegion's side.

  • Where: a run's error.
  • Next: Send it again; if it repeats, contact support with the run's id.

run_interrupted

The run was interrupted before it began: nothing ran.

  • Where: a run's error.
  • Next: Send it again.

run_cancelled

The run was stopped.

  • Where: a run's error.
  • Next: Nothing to fix.

run_superseded

Another run already handled this work.

  • Where: a run's error.
  • Next: Nothing to fix: read that run.

run_timeout

The run reached its time limit.

  • Where: a run's error.
  • Next: Start a new run on the same thread (it keeps its context), or split the task.

run_step_limit

The run used all of its steps.

  • Where: a run's error.
  • Next: Start a new run on the same thread; it keeps its context.

model_key_refused

The vendor refused the person's own model key (wrong, revoked, or without permission).

  • Where: a run's error.
  • Next: The person saves a new key (POST /model_keys), then sends the work again.

model_key_out_of_quota

The person's vendor account behind their own model key is out of funds or quota.

  • Where: a run's error.
  • Next: The person adds funds with the vendor, then sends the work again.

model_key_rate_limited

The vendor rate-limited the person's own model key after the SDK's retries.

  • Where: a run's error.
  • Next: Send the work again in a minute; the key's limits are the vendor's.

model_key_model_unavailable

The person's own model key cannot use the model the run's tier maps to.

  • Where: a run's error.
  • Next: The person gives the key access to that model with the vendor, or saves another key.

model_vendor_unavailable

The vendor of the person's own model key did not answer, or answered with a server error.

  • Where: a run's error.
  • Next: Send the work again in a few minutes.

model_key_missing

The person's own model key was removed while the run was going.

  • Where: a run's error.
  • Next: Send the work again; it runs on OpenLegion's models unless a key is saved again.

Actions

An action (a tool call the agent made) that didn't happen, or failed, carries one of these as its error.code.

tool_arguments_invalid

Your tool rejected the arguments the agent sent.

  • Where: an action's error.
  • Next: Your tool rejected the arguments the agent sent. The agent was told and may try again; a clearer description or input schema helps it send the right ones.

tool_failed

Your tool failed (threw) while it ran.

  • Where: an action's error.
  • Next: Your tool failed while it ran. The error went to your app's log (onError); the agent was told it failed.

tool_refused

Your tool refused the call on purpose (refuse(message, code)).

  • Where: an action's error.
  • Next: Your tool refused it. The agent read your message.

tool_not_available

The tool isn't available in this workspace: the workspace's version doesn't declare it, or it changed and needs a re-pin.

  • Where: an action's error.
  • Next: That tool isn't available in this workspace. Most often the workspace's version doesn't declare it: add it under connectors in a version, then promote that version or apply it to the workspace. If your app's tool changed since it was pinned, re-pin it (npx openlegion connectors pin).

dev_session_offline

No dev session (npx openlegion dev) was connected, so the call never reached your app.

  • Where: an action's error.
  • Next: No dev session (npx openlegion dev) was connected, so the call never reached your app. Start npx openlegion dev, then ask again.

app_unreachable

OpenLegion couldn't reach your app.

  • Where: an action's error.
  • Next: OpenLegion couldn't reach your app (no answer). Check that it's up.

app_timed_out

Your app didn't answer in time. For a write, whether it acted isn't known (outcome unknown).

  • Where: an action's error.
  • Next: Your app didn't answer within 20 s, so OpenLegion stopped waiting. If it went on to finish, OpenLegion has no record that it did: check before retrying.

app_signature_refused

Your app refused OpenLegion's signature.

  • Where: an action's error.
  • Next: Your app refused OpenLegion's signature (HTTP 401). It must verify with the connector's current secret: set it on the deployment, then run npx openlegion connectors pin.

connection_not_granted

No connection grants the agent the connected account it tried to use (the connection's agents, or the template version's apps, leave it out), so the action didn't run.

  • Where: an action's error.
  • Next: No connection grants this agent the connected account, so the action didn't run: the connection's agents, or your template version's apps, leave the agent out. To grant it, add the agent to the connection (POST /connections/{id} with agents), or list the app for the agent's template agent in a version's apps and apply that version.

tainted_argument

The run had read untrusted content, so the action did not run.

  • Where: an action's error.
  • Next: web.fetch: This run had read untrusted content, and this action would have sent some of it out, so it did not run. If that site is safe, add its host to allowHosts in policy_envelope.tools["web.fetch"] (status limited), then publish and promote the version. web.fetch then opens only the hosts allowHosts lists, on every run, and an allowed host can receive whatever a run that has read untrusted content sends there. agent.learn: This run had read untrusted content, so the lesson was not saved. files.delete: This run had seen untrusted content, in what it read or earlier in its conversation, so the file was not deleted. Any other tool: This run had read untrusted content, so this action did not run.

approval_rejected

A person rejected the action, so it didn't run.

  • Where: an action's error.
  • Next: A person rejected this action, so it didn't run.

action_interrupted

OpenLegion stopped the action on its side before it finished.

  • Where: an action's error.
  • Next: OpenLegion stopped this action on its side before it finished (the run lost its place, or the result held a secret and was withheld). The agent was told; send the work again if it's still needed.

action_failed

The action (a built-in tool, or a workspace's own connector) failed.

  • Where: an action's error.
  • Next: This action failed; the agent was told and may try another way.

action_outcome_unknown

OpenLegion stopped waiting for the action, so whether it happened isn't known.

  • Where: an action's error.
  • Next: OpenLegion stopped waiting for this action, so whether it happened isn't known: check before retrying.

Kit routes, on your server

If you mount the kit's handler (createHandler, or openlegion() for Next), its routes run on your server, and a route that refuses answers { "error": { "code", "message" } }: no type and no doc_url. signature_invalid adds reason. The SDK exports these codes as KIT_ROUTE_CODES. When the API refuses a person's request, the route passes on the API's own code with its type (the agent and schedule routes add param), and its entry is above.

The routes your pages call: chat, vault, agents and schedules. They exist only when you pass resolve.

CodeHTTPWhat happenedWhat to do
unauthorized401Your resolve found no signed-in person for this request.Sign the person in before showing the kit.
cross_origin403The browser call came from an origin the handler doesn't allow.Call the routes from your own site, or add the origin to allowedOrigins.
resolve_failed500Your resolve threw, or answered without a workspace id (ws_…).Fix resolve: it answers { workspace: "ws_…" } or null, and the error went to onError.
agent_unavailable502OpenLegion refused or failed the call your server made for this route: your key was refused, or the API failed. It says nothing about the agent itself: a paused agent is agent_paused, passed on with its own status. The reason went to onError.Read onError's reason: a wrong or revoked key (OPENLEGION_API_KEY, or the client you passed), or retry later.
invalid_thread400The thread id isn't a thread id (thr_…).Pass the thread's id: useChat({ id }), or <AgentChat threadId>.
invalid_run400The run id in the path isn't a run id (run_…).Use the run id the chat answered with, or the run of a message in the thread's history.
invalid_before400GET /chat/{thread}/messages's before isn't a message id (msg_…).Let <AgentChat> ask it: it passes the oldest message it shows, then the next_before the route answered.
invalid_trigger400The chat request's trigger isn't submit-message.Send messages with useChat's sendMessage, or <AgentChat>.
invalid_message400The chat message isn't one the route can send (the message says why).Send one person's message with text parts, as useChat does.
not_supported400The chat asked to regenerate an answer or to edit a sent message, which the kit doesn't do yet.Send a new message instead.
invalid_vault_item400The secure form's item isn't one the vault takes (the message says why).Send it from <VaultSecretForm>, which sends the right shape.
invalid_vault_query400GET /vault needs the thread (thr_…), the message (msg_…) and a vault name.Let <AgentChat> ask it: it reads the form's own message from the thread's history.
vault_kind_mismatch409A vault item with this name is already saved as another kind.Ask the agent to use another name.
vault_ask_missing409The secure form answers a reply drawn live, and the conversation's newest 100 messages have no ask for this item yet.Save again in a moment, once the reply is stored.
model_tier_not_allowed403A save or create named a model preset your allowModelTier said no to for this person (or threw for). The API was not called.Nothing, if your plans meant it: <AgentEditor> offers only the presets allowModelTier allows, so this is a race (the plan changed after the form was drawn) or a page of your own sending another preset. A throw went to onError.
invalid_agent400The agent id in the path or the body isn't an agent id (agt_…).Pass an id from the agents list (useAgents).
invalid_schedule400The schedule id in the path isn't a schedule id (sch_…).Pass an id from the schedules list (useSchedules).
invalid_site400The site in the path isn't a registrable domain in lower case (such as example.com).Pass a site from the agent's sites list (useBrowserSites).
invalid_app400The app isn't a catalog app id (lower case, such as google).Pass an app id from the catalog (useCatalog), or the app an agent asked for.
invalid_connection400The connection id in the path isn't a connection id (cxn_…).Pass an id from the connections list (useConnections).
invalid_server400The server to add isn't {url, name?} with an https url of at most 2048 characters and a name of 1 to 80 characters.Send {server: {url: "https://…", name?}} alone, as <AddServerForm> does (useConnections().connectServer).
invalid_connect_session400The connect session id in the path isn't one (cxs_…).Pass the id connect() answered (useConnections).
invalid_vendor400The vendor in the model key's path isn't anthropic or openai.Pass the vendor of the saved key (useModelKeys).
invalid_approval400The approval id in the path isn't an approval id (apr_…).Use the approval id of a held tool call in the chat (its output's approval).
invalid_decision400The decision isn't approve or reject, or its action_hash isn't a string or null.Send {decision: "approve" | "reject", action_hash} with the card's action_hash.
insufficient_role403The person resolve() answered may not decide this approval, or resolve answered no subject. A member decides only what their own conversation asked for, and not a tool whose approvals the template keeps for admins. Also a member's vault save over an item someone else saved (the form says so).Return the person's subject from resolve. An owner or admin decides every approval, and adds a site to any vault item: give a user that role in the workspace if they should.
invalid_body400The body isn't JSON, isn't an object, or isn't the shape the route takes (the message says what).Send what the message asks for. The kit's hooks and components, and OpenLegion's own calls, send the right shape.
invalid_file_name400An upload's name is empty or over 200 characters.Send the file's own name: <AgentChat> does.
invalid_file_type400An upload's Content-Type doesn't name a type.Send the file's type as Content-Type (the browser's File.type); OpenLegion reads the type from the bytes.
invalid_artifact400The artifact id in the path isn't an artifact id (art_…).Use an id from GET {basePath}/artifacts?thread=….
preview_not_text415The file isn't Markdown or plain text, so it has no text preview.Offer the download link instead.
preview_too_large413The file is over 256 KB, the most a text preview shows.Offer the download link instead.
download_unavailable503OpenLegion could not make a download link for the file just now.Try the download again in a moment.
body_too_large413The body is over the route's limit.Send less: the message says the limit.
method_not_allowed405The route doesn't answer this HTTP method.Use the method the message names.
resource_missing404No kit route answers at this path, or the browser routes have no resolve to serve them.Check that basePath matches where you mounted the handler, and pass resolve for the chat, vault, agent and schedule routes.

The routes OpenLegion calls, signed: webhooks, your template and the tool server.

CodeHTTPWhat happenedWhat to do
invalid_body400The body isn't JSON, isn't an object, or isn't the shape the route takes (the message says what).Send what the message asks for. The kit's hooks and components, and OpenLegion's own calls, send the right shape.
body_too_large413The body is over the route's limit.Send less: the message says the limit.
method_not_allowed405The route doesn't answer this HTTP method.Use the method the message names.
resource_missing404No kit route answers at this path, or the browser routes have no resolve to serve them.Check that basePath matches where you mounted the handler, and pass resolve for the chat, vault, agent and schedule routes.
signature_invalid400 or 401A call that must be signed by OpenLegion didn't verify (the reason field says why).If you didn't send it, nothing to do. If OpenLegion's own calls fail, check the secret matches the console's (OPENLEGION_WEBHOOK_SECRET or OPENLEGION_CONNECTOR_SECRET).
not_configured500A signed route has no secret to verify with.Set OPENLEGION_WEBHOOK_SECRET or OPENLEGION_CONNECTOR_SECRET, or pass webhookSecret or connectorSecret to createHandler.
handler_failed500Your webhook handler threw, so the delivery wasn't acknowledged.Fix the handler (the error went to onError); OpenLegion retries the delivery.
no_template404OpenLegion asked for your template, but the handler has none.Pass template to createHandler.
invalid_connector400The template request's connector isn't {id, slug}, or the template's tools don't fit it (the message says what).Name the connector that serves the tools as {id, slug}.
connector_required400The template has tools, but the template request named no connector to serve them.Name the connector that serves them ({connector: {id, slug}}).
template_failed500Building your template's definition threw.Fix the template: the error went to onError.