Errors, limits & retries
What comes back when a call does not work, and what to do about it. Probed against the live servers rather than written from a spec, including the parts that are currently rough.
Two shapes of failure
This trips people up more than anything else here, so handle both from day one.
| Protocol errors | A JSON-RPC error object. The request never reached a tool — bad JSON, unknown method, unknown tool name. |
| Tool errors | An HTTP 200 with a result carrying isError: true. The tool ran and refused. This is the MCP convention and it is easy to miss: a 200 is not success. If you only check error, you will treat every refusal as a win. |
// Both must be handled.
const res = await call('stories.list', {})
if (res.error) throw new Error(res.error.message) // protocol
if (res.result?.isError) handleToolFailure(res.result) // tool refused
Protocol error codes
| Code | Meaning | Notes |
|---|---|---|
-32700 | Parse error | Your JSON was malformed. Both servers return this with id: null. |
-32601 | Method not found | The JSON-RPC method does not exist. Valid methods: initialize, tools/list, tools/call, ping. |
-32602 | Invalid params | On Storytailor MCP this is an unknown tool name, and the response carries availableTools plus a didYouMean array worth showing in your own error output. |
-32600 | Invalid request | A structurally invalid payload. An empty body, or a shape that is not JSON-RPC. |
-32001 | Authentication required | Server-defined. A well-formed call whose credential is missing, malformed or wrong. Branch on the code, not the message text, and never retry without changing the key. |
Both servers now behave the same way
Until 2026-08-30 Story Intelligence collapsed every unauthenticated failure into one -32600, so an unknown method, a typo’d tool name and a valid call were indistinguishable. Fixed: the request is validated before the credential is checked, and each of the three is answered on its own terms. If you built a workaround for the old behavior, remove it.
Tool errors
AUTH_TOKEN_INVALID | The bearer token is wrong or expired. Re-authenticate; do not retry with the same token. |
Missing authentication | The tool needs a user and none was supplied. The message names the tool and how to supply one. |
Validation messages | A required argument was absent, for example “email required”. Fix the call; retrying will not help. |
402 / quota | On Storytailor MCP this means the USER hit their plan ceiling, not that your integration broke. Show their real plan and limit; the subscription tools return both. |
Rate limits
Limits are enforced per organization and scale with your plan, and every authenticated response tells you where you stand, so you never have to find a limit by hitting it.
RateLimit-Limit: 3 # calls allowed in the window RateLimit-Remaining: 2 # calls left, never below zero RateLimit-Reset: 41 # seconds until the window resets Retry-After: 41 # present only when you are over
Field names follow the IETF RateLimit draft, and are exposed via CORS so browser-side code can actually read them. Unauthenticated calls carry no headers, having no budget to report.
| Retry | Transport failures and 5xx only. Exponential backoff with jitter, capped at five attempts. |
| Never retry | -32602, validation failures, AUTH_TOKEN_INVALID, quota refusals, or any safety refusal. Nothing about the second attempt differs from the first, and retrying a safety refusal is the one that will lose you access. |
| Never retry blind | Generation is asynchronous. If compose times out on your side the work may still be running, poll status before starting again, or you will pay for two. |
| Idempotency | Generation calls are not idempotent. Hold your own request key and check status before re-issuing. |
Sign in with Storytailor errors
Different product, different rules. SIWS is a standard OIDC provider, so it speaks OAuth error codes rather than the JSON-RPC ones above, and it returns them as { "error", "message" } — note message, not the spec’s error_description. Read the code, not the key.
| Code | HTTP | What actually happened |
|---|---|---|
client_not_active | 403 | The one you will hit first. Every client is created pending and only an explicit activation makes it active. Nothing is wrong with your request — the app has not been switched on yet. This fails closed on purpose, so a client can never serve families before someone deliberately turns it on. |
invalid_client | 400 | Unknown client_id, or a secret that does not match it. |
invalid_grant | 400 | The authorization code is expired, already spent, or does not match your redirect_uri or PKCE verifier. Replaying a used code revokes every token minted from it (RFC 6749 §4.1.2) — a replay is treated as theft, not as a retry, so never retry a token exchange with the same code. |
invalid_request | 400 | A required parameter is missing or malformed. |
unsupported_grant_type | 400 | Only authorization_code and refresh_token are supported. |
access_denied | — | The parent declined at the consent screen. Not a fault: it is the product working. Return them somewhere kind and do not retry automatically. |
server_error | 500 | Ours. Safe to retry once with backoff. |
There is no per-tool rate limit here because there are no tools — the limits that apply are the ordinary ones on the authorize and token endpoints, and a normal sign-in never approaches them.
Safety refusals are not errors
A refused generation is the system working. Do not retry it, do not reword the prompt to get around it, and do not build a fallback that serves unchecked content when a check fails. Fail closed: no story is always the correct outcome over an unchecked one. Show the person something calm and true, and never show a child a stack trace.