bad_request (HTTP 400) with { code: "bad_request", detail, request_id }. The SDK throws with detail — a human-readable message string, not a typed error object. Match on the substring shown below.
User-authentication failures additionally carry a machine code at the front of detail (e.g. eth_authenticator_limit: …), so the SDK can branch with a single startsWith.
Status codes that changed in
testnet-v1.0.12. Branch on the HTTP status and the stable code field, not only on 400:- 404
not_found— naming a platform (tee:) contract version that is not registered (sincetestnet-v1.0.14the text isContract <name>@<version> is not registered., withreason: contract_not_registered). It used to be a bare 500internal_error. The node still retries first, because a follower may not have replicated the contract yet, so the 404 means the version really is missing: check for a typo or a retired version. Calls to your ownz:contracts run the version you have deployed, whatevercontract_versionthe request names. - 401
unauthorized—POST /api/invokeandPOST /api/discoverrefusing the credential (a bad, missing or revoked API key). The body carries the refusal message. An API-key caller that treated this as a 400 must now accept a 401. - 503
service_unavailable— a write conflict that survived the node’s retries (see the table below).
Since
testnet-v1.0.10, every 4xx/5xx response is JSON, not just contract-level bad_requests. Previously, a request rejected before it reached a contract (a malformed query string, an undecodable path segment, an oversized body) could come back as raw text/plain instead of the standard envelope. An error_envelope middleware now re-encodes any such rejection into the same { error, code, request_id } shape, under the original HTTP status. If your integration special-cased plain-text error bodies, that code path is now dead — everything is JSON.Tenant operations — register, maps, dispatch
Contract-authored errors are whatever your contract returns. The
walkthrough vault, for
instance, returns
no record stored for this customer when check runs before
the customer called store, and only the customer can do this for themselves; an agent cannot when an agent calls store or forget — those are the
contract’s own messages, not platform errors.Agent credit funding (createAgent’s initialCredits, fundAgent)
Both dispatch into tee:admin.agent-credit-transfer, which re-verifies authorisation independently of the caller — it never trusts tee:organisation or the SDK/CLI that invoked it.
Generic / opaque failures (HTTP 500, no clear cause)
Abad_request gives you a substring to match on. A bare HTTP 500 with no further detail is a different situation — it usually isn’t your contract logic. Before assuming it’s a bug in your code, check these in order:
- Grab the
request_id. Most 500 responses still include one — save it before you start changing code. If you end up asking for help, it’s the single most useful thing you can hand over. - Re-check egress and ACLs first. A missing outbound-host grant or a missing map ACL entry can surface as a 500 instead of the more specific error you’d expect — re-read the egress and map ACL requirements before looking further.
- Retry once, deliberately. A single unhealthy node can return a 500 for requests that are otherwise correct. If an identical request succeeds on retry, it was very likely transient — no code change needed.
- If it’s consistent and reproducible, it’s more likely a platform-side issue than your integration. Report it in the developer Telegram with the
request_id, rather than spending hours guessing at workarounds.
Common integration gotchas
These aren’t errors with a fixed message — they’re patterns that produce confusing behavior downstream, reported independently by multiple teams.Authentication & wallet linking
These come from the user/session contract during sign-in andaddAuthMethod, with the code at the front of detail: