Errors
What the HeyBrain MCP server returns when a request or tool call fails, and what to do about each error.
Errors come back at two levels: the HTTP response to the MCP request, and the result of an individual tool call.
Connection errors#
| Status | Meaning | What to do |
|---|---|---|
401 invalid_token, “Authentication required” | No credential, or not sent as Authorization: Bearer …. | Add the key header, or complete browser sign-in. |
401 invalid_token, “The agent key is unknown, revoked or expired” | The key does not work any more. | Generate or rotate a key, update the tool and restart it. |
503 temporarily_unavailable | HeyBrain could not check the key. | Retry after the Retry-After delay (5 seconds). |
405 | A GET request. The server accepts POST only. | Send JSON-RPC as POST. |
Tool errors#
A failed tool call returns a result with isError: true. Its text names the failure, a code, the HTTP status and a remedy, and tells the agent not to invent an answer:
Error executing tool search_documents: ERROR: search failed — Search failed [rate_limited] (HTTP 429) — Too many requests. Wait briefly, then retry with backoff.| Code | HTTP | Meaning |
|---|---|---|
invalid_request | 400, 422 | A parameter is missing or invalid. |
unauthorized | 401 | The key expired or was revoked. Do not retry with the same key. |
payment_required | 402 | Out of AI credits, a spend limit was reached, or the subscription needs attention. |
forbidden | 403 | The caller’s role, plan or a governance rule does not allow it. Retrying unchanged will not help. |
not_found | 404 | No such item, or the caller cannot access it. |
conflict | 409 | Usually held for approval. See below. |
payload_too_large | 413 | The input is too large. |
rate_limited | 429 | Too many calls. The server retries once, honoring Retry-After, before returning this. |
server_error | 5xx | Retry once. If it repeats, report it. |
timeout, unreachable | – | HeyBrain did not answer in time. |
Specific codes#
Some failures add a specific code after the general one, for example [forbidden:PLAN_LIMIT_REACHED].
| Code | Meaning |
|---|---|
PLAN_LIMIT_REACHED | Your plan’s limit for this resource is reached. See Plans and limits. |
DLP_BLOCKED | The content matched a data-loss-prevention rule, for example a secret, and was not saved. |
DLP_SCAN_UNAVAILABLE | The content could not be scanned, so it was not saved. Retry later. |
STORAGE_FULL | Your storage is full. |
ALLOWANCE_EXHAUSTED, SPEND_LIMIT_REACHED, SPEND_FROZEN, SUBSCRIPTION_PAST_DUE | Credits or billing need attention in the dashboard. |
AGENT_ACTION_HELD | The action needs approval. See below. |
APPROVAL_TICKET_REJECTED | The approval ticket was rejected, expired or already used. |
Held for approval#
When a governance rule requires approval, a write returns [conflict:AGENT_ACTION_HELD] with a ticket id. After someone approves it, call the same tool again with approval_ticket set to that id. A ticket works once, within 24 hours.
Sign-in (OAuth) errors#
The authorization server returns standard OAuth errors as { "error", "error_description" }, for example invalid_grant, invalid_scope or access_denied. Errors during authorization redirect back to the client when its redirect URI is verified, and otherwise show an error page.
Note: Error details are capped at 500 characters, and anything that looks like a key is redacted before it reaches the agent.
Last checked against the product on November 25, 2026.