Fortell
Developers

Errors and refusal codes

Every refusal has a status and a code. Branch on the code. The text can change.

The shape of a refusal

A tool refusal is the tool's own JSON, with error (a sentence) and code (a stable name), and an HTTP status. A refusal never moves money. Read the code, fix the cause, then call again. Do not retry a 422 without a change.

Status and code

StatusCodeMeaning
400invalid_argumentsAn argument is missing or wrong. The message names it.
400api_key_in_urlThe key was in the URL. Send it in the Authorization header. Revoke that key.
401api_key_missingNo Authorization header.
401api_key_invalidThe key is not a Fortell key, or it is unknown.
401api_key_revokedYou revoked this key. Make a new one.
401api_key_expiredThe key passed its expiry date. Make a new one.
401api_key_wallet_unlinkedThe wallet of this key is no longer linked to your account.
401api_key_signed_outYou signed out of every session after this key was made. Make a new one.
401api_key_account_inactiveThe account is not active.
403api_key_scopeThe key lacks a scope. The body field needs names it.
403confirm_needs_websiteThis step needs a confirmation on the website. A key cannot give one.
403wallet_not_yoursYou named a wallet that is not the wallet of the key. Omit wallet.
404not_foundNo such endpoint. GET /v1/agent lists them.
405method_not_allowedWrong HTTP method. The Allow header names the right one.
409in_flightThe same call is still running. Wait, then read your state.
422(the tool's code)The tool refused. The body has error and code. Read the code and do not retry blindly.
429rate_limitedOver a limit. Wait Retry-After seconds.
503api_keys_offAPI keys are off on this server.
503store_unavailableThe server store is down. Try again shortly.
503limiter_unavailableThe limiter is down. Try again shortly.

The 429, 409 and 503 codes are the same ones the MCP returns. A tool also has its own codes, for example for an order below the smallest size. They come back with status 422.

What to do

  • 401: check the key, its expiry and its wallet. Make a new key if it was revoked.
  • 403 api_key_scope: make a key with the scope named in needs.
  • 409: the same call is still running. Wait, then read your state.
  • 429: wait the Retry-After seconds.
  • 503: try again shortly. Back off between tries.