Token VaultDocs
Reference

Errors and Exit Codes

Every HTTP status and error code the Token Vault API returns, the five body shapes they arrive in, and the tvault CLI exit codes.

Body shapes

Branch on detail.code (or code), not on message.

ShapeUsed forExample
Detail envelopeAlmost every refusal{"detail": {"code": "NO_GRANT", "message": "..."}}
Bare detailPlain 4xx without a code{"detail": "Agent not found"}
Rate limitFloor, penalty box, no-grant misses, ceiling{"error": "Rate limit exceeded", "code": "RATE_LIMITED", "retryAfter": 41} plus Retry-After
Policy denialA policy refused{"error": "Access denied by policy", "policy": "...", "rule": "...", "reason": "...", "code": "POLICY_DENIED"}
JSON-RPCMCP routes{"jsonrpc": "2.0", "id": 1, "error": {"code": -32029, ...}} or a tool result with isError: true

Scope refusals add missingScope and missingScopes to the detail:

{"detail": {"code": "SCOPE_DENIED", "message": "Missing required scope: tokens:create", "missingScope": "tokens:create", "missingScopes": ["tokens:create"]}}

Request validation failures are 422 with code: "VALIDATION_ERROR" and a single readable message. An unexpected server error is 500 with code: "INTERNAL" and a generic message. Details of the shapes that carry policy and rate-limit data: Denials.

HTTP status codes

StatusMeaning here
200, 201Success
307Credential redirect to your webhook (agent credentials)
400Bad input, or a NO_FIELDS / INVALID_EXPIRY style validation error
401No or bad identity, expired key, or REAUTH_REQUIRED
403Authenticated but refused: scope, grant, policy, suspended, human-only
404Unknown object, or NO_GRANT
409Conflict: name taken, rotation race, refresh needs reconnect
410Feature turned off (OAUTH_CONNECT_DISABLED)
412Precondition: webhook not bound, agent suspended, no refresh token
422Validation error with a code
423VAULT_LOCKED: you stopped all access
424Your webhook answered but could not do it (REFRESH_FAILED_AT_WEBHOOK)
429Rate limited. Always read Retry-After
502Webhook unreachable or misconfigured
503Webhook circuit open, or a check could not be completed. Retry

Error codes

Identity and scopes

CodeHTTPCLI exitMeaning
MISSING_KEY4012No key sent
INVALID_KEY401 (403 on GET /api/agents/credentials for classic agent keys)12Unknown, revoked, rotated-out or malformed key
KEY_EXPIRED40110Past its expiry. Rotate it or create a new one
KEY_SUSPENDED40311The key is suspended
AGENT_INACTIVE40311The agent is suspended or deleted
WRONG_RESOURCE401A tvsess_ issued for a different MCP URL
IDENTITY_ONLY_SESSION403The session proves identity only
REAUTH_REQUIRED4012A sign-in within the last 5 minutes is needed
SCOPE_DENIED4038The key lacks the scope in missingScope
HUMAN_ONLY4039Only a signed-in human can do this
SCOPE_NOT_DELEGABLE4031A key or agent tried to give a human-grant-only scope to another. scopes lists them
UNKNOWN_SCOPE4001Scope name not in Scopes
SELF_CHANGE_FORBIDDEN4031A key or agent tried to loosen its own controls (scopes, resume, policies, grants). Suspending, renaming and rotating itself are allowed
SELF_GRANT_FORBIDDEN4031A key or agent tried to add or remove its own grants
ROTATION_CONFLICT4091Two rotations of the same key raced. No new key was issued
KEY_NOT_ACTIVE4091Only an active key can be rotated
INVALID_EXPIRY4001Expiry in the past or beyond 10 years, or both expiresInHours and expiresAt named. A later expiry than the creator's is silently clamped

Grants and access

CodeHTTPMeaning
NO_GRANT404 (403 on the MCP server endpoint)No live grant. Same answer whether the credential exists or not
GRANT_EXPIRED403The grant lapsed
GRANT_TOOLS_ONLY403The grant lacks value. "This grant does not allow reading the credential value; it can only be used through MCP access."
GRANT_NOT_FOR_TOOLS403The grant lacks tools (MCP server endpoint)
SERVER_NOT_GRANTED403The MCP grant does not cover the MCP server
SERVER_NOT_FOUND404The credential has no MCP server of that name
GRANT_REQUIRED403You need a live grant of your own to pass it on. Also when the stored value is no longer the creation the access was made for
GRANT_USES_EXCEEDED403A key or agent asked for uses with no overlap with the grant it copies from. A partial overlap is cut down silently. An MCP-only grant cannot be passed to a key
GRANT_SERVERS_EXCEEDED403Same, for servers
QUOTA_EXCEEDED403You reached the cap for that kind of object (credentials, agents, keys, policies). Adds entityType and limit. Not retryable: delete one first
RESERVED_SERVICE_NAME400The credential name is reserved
INVALID_GRANT_USES422uses empty, unknown, or tools without an MCP server on the credential; or uses sent on a key grant
INVALID_GRANT_SERVERS422servers without tools, empty, or naming an MCP server the credential lacks
NO_FIELDS400A PATCH named no field to change
GRANT_ENTRIES_DIFFER409One expiry for the whole grant would shorten a part that ends later. Send entries to change each part
ENTRY_NOT_HELD422entries named a part the grant does not hold
ENTRIES_OR_FIELDS422A PATCH sent entries and uses, servers or an expiry together
REQUESTED_ITEM_MISSING422A request named a credential, agent, API key, MCP server or policy that does not exist. The message lists them
AMBIGUOUS_POLICY_NAME409Two policies share the name a request used. Rename one in the web app
POLICY_NAME_TAKEN409A request asked to create a policy with a name that exists
RESERVED_NAME422An agent or API key can't be named self: requests use it to mean the sender
TARGET_CHANGED / POLICY_CHANGED409 (in an approve result)The agent, API key or policy behind a name changed after the request was made. That action did nothing
MANUAL_GRANT_IN_PLACE / AUTO_GRANT_IN_PLACE409A key or agent tried to replace one grant kind with the other. A human can
WEB_CONSOLE_REQUIRED403A Who can read policy makes this change web-app only
POLICY_DENIED403 / 429A policy refused. See Denials. On your own read (reveal with POST /api/vault/credential-ticket, GET /api/tokens/{service}, the TOTP code) the same fields sit under detail, with a message
VAULT_LOCKED423You stopped all access

Grant endpoints: Grants API.

Credentials, labels, MCP servers

CodeHTTPMeaning
INVALID_SERVICE400Credential name has / or characters not allowed
INVALID_LABELS422Label not 1-32 of a-z, 0-9, -; not a list; or more than 10
INVALID_ENTITY_TYPE400entityType is not credential, agent or api_key
INVALID_ENTITY_ID400entityId empty or over 128 characters
MCP_SERVERS_CAP422More than 5 MCP servers on a credential
MCP_SERVER_NAME_INVALID422Name not ^[a-z0-9][a-z0-9_-]{0,31}$
MCP_SERVER_NAME_DUPLICATE422Two MCP servers share a name
MCP_SERVER_HEADERS_REQUIRED422No headers, or none contains ${TOKEN} (${AGENT_SESSION} on a sign-in credential)
MCP_SERVER_HEADER_INVALID422Bad header name, or control characters in a value
MCP_SERVER_LITERAL_CREDENTIAL422A credential-like header holds a literal value instead of ${TOKEN} (${AGENT_SESSION} on a sign-in credential)
MCP_SERVER_INVALID422template is not a short slug
SERVICE_NOT_HOSTABLE422The credential name cannot appear in a URL
MCP_SERVER_NOT_FOUND404No such MCP server (or a malformed name on the endpoint)
MCP_SERVER_CHANGED409The MCP server changed while its tools were fetched
VALUE_NOT_ALLOWED400A key tried to send a credential value through Token Vault. Use a store ticket
TOKEN_OWNED409The name belongs to someone else, or still has bindings
TOKEN_EXISTS409tvault add (a store ticket with intent: "create") named a credential that already exists. Nothing was replaced. Use tvault set to rotate the value
TOKEN_OWNERSHIP_UNAVAILABLE / TOKEN_EXISTENCE_CHECK_UNAVAILABLE503Could not verify. Nothing was changed. Retry

Details: Labels API, MCP servers API.

Token Vault sign-in and old MCP connections

For Token Vault sign-in credentials and the old MCP connection URLs.

CodeHTTPMeaning
NAME_TAKEN409POST /api/tokens/sign-in: the name exists, of any kind. Also reported by Convert for one connection
USE_SIGNIN_ROUTE400POST /api/tokens with tokenType: "TVSignIn". Use POST /api/tokens/sign-in
SIGNIN_NO_VALUE409A value action on a sign-in credential: credential ticket, store ticket, OAuth connect, rotate, refresh, TOTP code
SIGNIN_TOOLS_ONLY409A grant on a sign-in credential with value, or any key grant. Only MCP for an agent
SIGNIN_URL_ON_TOKEN_VAULT422The URL of a sign-in MCP server is a Token Vault address
SIGNIN_SESSION_REFUSED403The agent cannot get a pass (suspended, expired, no mcp:use, deleted)
SIGNIN_SESSION_UNAVAILABLE503The lock state could not be read. Retry-After: 60. (Stopped access is VAULT_LOCKED, 423.)
SIGNIN_SSRF_GUARD502The address of the sign-in MCP server is refused
SIGNIN_UPSTREAM_ERROR502The call to the sign-in MCP server failed
SIGNIN_SERVER_NOT_AGGREGATEDtool errorA sign-in MCP server was asked for on /api/agents/mcp. Use its own URL
PROXY_CONFIG_INVALID500An MCP server config fits neither the ${TOKEN} path nor the ${AGENT_SESSION} path. Refused, not guessed
MCP_KEY_RETIRED410An old mcp_ app key past its 90 days
PROXY_CREATE_REMOVED410POST /api/proxy. Add an MCP server to a credential instead
PROXY_GROUPS_REMOVED410A write to proxy folders
PROXY_FROZEN409A change to a converted old MCP connection. Only {"status":"suspended"} is allowed
PLAN_CHANGED409Convert: your account changed since the preview. Preview again
INVALID_OPT_IN422Convert: an opt-in the preview did not offer
MCP_TOGGLE_REMOVED400mcpEnabled: false on an agent. The per-agent MCP switch is gone
SCOPE_RETIRED400Adding proxies:read or proxies:write to a key or agent. retiredScopes lists them

Convert reports NAME_BUSY, PROXY_GONE and CONVERT_FAILED per connection under errors. Skip codes are on Old MCP connection URLs.

Agents

CodeHTTPMeaning
AGENT_NAME_TAKEN409Another agent has this name, or one you did not create
AMBIGUOUS_AGENT_NAME409More than one agent has this name. Use the id
AGENT_NAME_CONFLICT409A concurrent create won. Try again
AGENT_NOT_FOUND404POST /api/agents/connect without createIfMissing

OAuth apps and refresh

CodeHTTPMeaning
OAUTH_CONNECT_DISABLED410Connecting through Token Vault's own OAuth app is off. Use your own OAuth app
UNKNOWN_PROVIDER404Provider is not google, github or spotify
INVALID_CLIENT_ID400Not a valid OAuth client id
INVALID_SCOPE400A scope has characters that are not allowed
CLIENT_ID_MISSING400Save the provider's client id first
WEBHOOK_UNSUPPORTED409The webhook lacks the oauth-callback capability. Update it
TOO_MANY_PENDING42920 connects in flight. Wait a few minutes
REFRESH_RECONNECT_REQUIRED409The provider revoked the grant. Reconnect, or pass recheck=true
REFRESH_NO_TOKEN404No token stored on the webhook
REFRESH_NO_REFRESH_TOKEN412The stored token has no refresh token
REFRESH_FAILED_AT_WEBHOOK424The webhook answered but the refresh failed
WEBHOOK_RATE_LIMITED429Your webhook is rate-limiting Token Vault

Details: OAuth apps API, Token refresh.

Webhook

CodeHTTPMeaning
WEBHOOK_NOT_CONFIGURED502No webhook bound
WEBHOOK_UNAVAILABLE502Could not be reached
WEBHOOK_AUTH_FAILED502The webhook rejected Token Vault's signed request
WEBHOOK_REDIRECT_BLOCKED502The webhook answered with a redirect, which is never followed
UPSTREAM_REDIRECT_BLOCKED502The MCP server redirected to another address. Neither your webhook nor Token Vault follows it. Set the MCP server's URL to its final address
WEBHOOK_CIRCUIT_OPEN503Failed repeatedly and paused. Retry-After is set

Webhook-side error codes are on Webhook error codes.

CLI exit codes

tvault maps the server code first and the HTTP status second. Branch on the exit code in scripts.

ExitKindArises from
0successSuccess. Also argument-count errors, which print help
1userBad arguments or validation, not found, aborted prompt, any other 4xx (400, 403, 404, 409, 422), GRANT_REQUIRED, UNKNOWN_SCOPE, INVALID_EXPIRY
2authNo active context, context not found, any 401, a failed session refresh, REAUTH_REQUIRED
3networkCannot reach the API or the webhook
4server5xx, a malformed ticket response, a webhook that refused the store ticket
5vault locked423 or VAULT_LOCKED
6emptyThe credential exists but has no value (get --check, empty webhook token, missing composite field)
7rate limited429, including a policy rate_limit denial. GETs make 3 attempts in all, honouring Retry-After up to 10 s
8scope deniedSCOPE_DENIED (also a lookup by name when listing is denied)
9human onlyHUMAN_ONLY; a classic agent on a management route; a non-admin mcp-servers overwrite
10key expiredKEY_EXPIRED
11key suspendedKEY_SUSPENDED or AGENT_INACTIVE
12invalid keyINVALID_KEY
13policy deniedPOLICY_DENIED (a policy rate_limit denial that arrives as 429 stays 7). CLI 0.14.0 and later; earlier versions exit 1
14no grantNO_GRANT, GRANT_EXPIRED, GRANT_TOOLS_ONLY. CLI 0.14.0 and later; earlier versions exit 1
printf %s "$V" | tvault add stripe
case $? in
  0)  echo ok ;;
  8)  echo "key needs tokens:create" ;;
  10) echo "key expired, rotate it" ;;
  11) echo "key or agent suspended" ;;
  12) echo "bad key" ;;
esac

A presence probe that never prints the value:

tvault get github --check >/dev/null 2>&1 && echo present

Run tvault explain <CODE> for what a code means and how to fix it. Full CLI reference: tvault CLI.

Ready to try it?

Sign in with Google or email. Your credentials stay on your own webhook, and the quickstart gets Claude Code making its first MCP tool call in about 15 minutes.

On this page