Troubleshooting
# Troubleshooting
Find the exact error string in the table for the surface you're using. Each row is symptom → cause → fix.
## Scanning and proofs
| Symptom | Cause | Fix |
| ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `InvalidIdentityCommitmentRoot` in the Self app | The document doesn't match the network. Celo Sepolia takes mock passports only; Celo Mainnet takes real documents only | Start a session on the matching network. For `testnet`, use a mock passport: Settings → **Manage ID documents** → **Generate Mock Document** ([guide](/docs/self-enterprise/guides/using-mock-passports/)). The CLI defaults to `testnet`; the SDK, A2A and MCP to `mainnet` |
| Registered, but `isVerified` / `verified` is `false` | `hasHumanProof` is `true` but `isProofFresh` is `false`: the proof passed `proofExpiresAt` | Refresh in place: `requestProofRefresh({ agentId, network })` or [`POST /api/agent/refresh`](/docs/agent-id/rest-api/#proof-refresh) |
| A contract accepts an expired agent | `isVerifiedAgent()` alone ignores expiry | Also check `isProofFresh(getAgentId(key))` |
## SDK and verifier
Errors from `verifier.auth()` (`401` unless noted) and `verifier.verify()`:
| Error | Cause | Fix |
| ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Missing agent authentication headers` | Signature or timestamp header missing (or stripped by a proxy) | ECDSA agents send `x-self-agent-address`, `-signature`, `-timestamp`. Ed25519 agents send `x-self-agent-keytype: ed25519`, `x-self-agent-key`, `-signature`, `-timestamp` |
| `Timestamp expired or invalid` | Timestamps are unix **milliseconds** and valid for 5 minutes | Sync clocks; sign right before sending |
| `Invalid signature` | The signed bytes differ from what arrived | Sign `keccak256(timestamp + METHOD + pathWithQuery + keccak256(body))`: path plus query, no host, the raw body |
| `Replay detected` | The same signature was sent twice | Sign every request fresh |
| `Agent not verified on-chain` | Key not registered on the verifier's network, or deregistered. On a `POST`: a re-serialized or altered body makes ECDSA recover a different signer | Match the network (`.network('testnet')` for testnet agents; the default is `mainnet`). For `POST`s, verify `req.rawBody`, not `JSON.stringify(req.body)` |
| `Agent's human proof has expired` | `proofExpiresAt` has passed | Refresh the proof |
| `Agent was not verified by Self — proof provider mismatch` | The agent's proof came from another provider | Accept other providers with `.requireSelfProvider(false)`, or register through Self |
| `Human has 3 agents (max 1)` | The verifier allows 1 agent per human by default; the registry allows 10 on mainnet and no cap on testnet | `.sybilLimit(n)` for your policy, or `.sybilLimit(0)` for no limit |
| `Agent's human does not meet minimum age (required: 18, got: 0)` | Registered without an age disclosure. Demo agents 1, 5 and 72 have none | Register with `disclosures: { minimumAge: 18 }` (or `--minimum-age 18`) |
| `Agent's human did not pass OFAC screening` | Registered without `ofac`, or the document isn't a passport (`ofac[0]` is `false` for ID cards and Aadhaar) | Register with `ofac: true`. Non-passport holders can't pass `requireOFAC()` ([known limitation](#known-limitations)) |
| `Missing agent key for Ed25519 verification` | Manual `verify()` with `keytype: 'ed25519'` but no `agentKey` | Pass `keytype` and `agentKey` (the `x-self-agent-key` header) |
| `Invalid Ed25519 signature` | Wrong key, or the signed message differs | Sign the same message as ECDSA agents, with the key in `x-self-agent-key` |
| `500` `Raw request body unavailable for signature verification` | A body arrived but `req.rawBody` is missing (the console logs a hint) | `express.json({ verify: (req, _res, buf) => { req.rawBody = buf; } })`, or `express.text()` / `express.raw()` |
| `503` `Agent verification unavailable, try again later` | The verifier's RPC call failed | Retry, or set `.rpc(url)` |
## CLI
| Symptom | Cause | Fix |
| ---------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| `npx self-agent` fails with an npm 404 | No npm package is named `self-agent`; the binary ships in the SDK | `npx -p @selfxyz/agent-sdk self-agent ...` |
| `wait` times out although the human scanned | The session's `--network` doesn't match the network of the QR they scanned | Wait on the session file that produced the scanned QR, or `init` again with the right `--network` |
| `Last poll error: RPC call did not complete before the timeout` | A short `--timeout-seconds` cut off the last poll (exit code `2`) | Nothing is broken: run `wait` again, or raise `--timeout-seconds` |
| ``Session expired. Run `register init` again.`` (exit code `1`) | The session passed `expiresAt` (default `--ttl-minutes 30`) | Run `init` again |
| `--mode ed25519 is not supported by the CLI. Use linked or wallet-free, ...` | The CLI supports `linked` and `wallet-free` only | Use `requestRegistration({ mode })` or the [REST API](/docs/agent-id/rest-api/#start-a-registration) |
| `Export blocked. Re-run with --unsafe.` | Export needs explicit consent | Add `--unsafe` plus `--out-key <path>` or `--print-private-key` |
| A flag seems to have no effect | Unknown flags are ignored silently, so typos fall back to defaults | Check the spelling against [Commands and flags](/docs/agent-id/cli/#commands-and-flags) |
| Need another chain or deployment | `--network` knows only `mainnet` and `testnet` | Pass `--chain`, `--registry` and `--rpc` together |
## REST API
| Response | Cause | Fix |
| --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `400` `Missing session token. Provide Authorization: Bearer <sessionToken>.` | The token wasn't sent as a header (query-string tokens are ignored) | Send `Authorization: Bearer <sessionToken>` |
| `400` on a status route with a valid token | The token belongs to another flow (e.g. a registration token on `/deregister/status`) | Use the token from that flow |
| `401` `Invalid session token` | Truncated, altered, or from another deployment | Send the exact `sessionToken` from the latest response |
| `401` on `/api/qr/...` | A session token was used as a QR token | Use the `scanUrl` as returned |
| `409` `Cannot export key until registration is complete. Current stage: qr-ready` | The human hasn't finished, or you sent an older token (the start token always says `qr-ready`). Ed25519 sessions get this too before completion | Poll status until `completed`, then export with the **rotated token from that poll** |
| `400` from export after completion | Ed25519 session: the agent already holds its key | Nothing to export |
| `409` on `/api/agent/register/qr` | The session is past `qr-ready` (already scanned) | Poll status instead |
| `410` `Session expired` | Sessions last 30 minutes; export works for 30 minutes after the poll that saw `completed` (repeatable inside it) | Start a new session. EVM-mode sessions can still be polled for up to 24 hours to catch a late scan |
| `400` `This agent has no stored verification config ...` on refresh | The agent was registered before config tracking (demo agents 1 and 5) or through an external provider | Deregister and register again |
| `422` on refresh | The 32-byte agent ID has a byte of `0x80` or more (e.g. IDs 128–255) | Deregister and register again, which mints a new ID ([details](/docs/agent-id/rest-api/#proof-refresh)) |
| `400` on `POST /api/agent/deregister` for an Ed25519 agent | Ed25519 agents aren't deregistered with a scan | Guardian calls `guardianRevoke(agentId)`, or the NFT owner calls `selfDeregister(agentId)` on the registry |
| `404` `Agent not found` | Never minted, burned, or the wrong chain | Check the chain ID in the path: `42220` mainnet, `11142220` testnet |
| A2A `lookup` returns a completed task with `data.error: "Agent not found"` | Unknown agents are a result, not a failed task | Check `data.error` on completed tasks |
| `429` `Rate limit exceeded. Try again later.` | Per-IP limit; everyone behind one NAT shares it | Wait `Retry-After` seconds (or `retryAfterMs`); poll every few seconds. A2A reports JSON-RPC `-32000`. [Limits](/docs/agent-id/rest-api/#rate-limits) |
| `502` `RPC error` | The API couldn't read the chain | Retry. For a visa write, a `502` with `txHash` means it was broadcast: check on-chain before retrying |
Every status poll rotates the session token, so always send the latest one. Earlier tokens stay valid until expiry, so treat all of them as secrets. The SDK (`waitForCompletion`, `exportKey`) handles this for you.
### Visa writes
| Response | Cause | Fix |
| ---------------------------------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `401` | Stale, reused or malformed signature | Sign a fresh `timestamp` (5 minutes, single use) over the exact [message](/docs/agent-id/rest-api/#visa-writes) |
| `403` | The signer isn't the NFT owner, the agent's EVM key, or the wallet behind a wallet-based ID | Sign with one of those |
| `409` | The agent is already at or above `targetTier` | Nothing to do |
| `422` `NOT_ELIGIBLE` / `REVIEW_REQUIRED` | Metrics below the tier thresholds, or tier 3 needs an approved manual review | Improve the metrics, or request review first |
## MCP
| Symptom | Cause | Fix |
| -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `406` `Not Acceptable: Client must accept both application/json and text/event-stream` | A raw request without the right `Accept` header | Send `Accept: application/json, text/event-stream` (MCP clients do this for you) |
| `405` on `GET` or `DELETE` | The hosted server is stateless Streamable HTTP | Use `POST` |
| The client ignores `.mcp.json` | Missing `mcpServers` wrapper | `{ "mcpServers": { "self-agent-id": { "type": "http", "url": "https://agent-api.self.xyz/api/mcp" } } }` |
| Privileged tools (`self_get_identity`, `self_sign_request`, ...) are denied | They act as the server's own agent, which the hosted server doesn't offer | Sign as your own agent with the [local server](/docs/agent-id/guides/mcp-user/#local-server) and `SELF_AGENT_PRIVATE_KEY`, or run your own deployment with `MCP_PRIVILEGED_API_KEY` |
| `self_verify_agent` fails for a human with several agents | `max_agents_per_human` defaults to `1` | Pass `max_agents_per_human: 0` (no limit) or your cap |
| `self_verify_request` can't check an Ed25519 request | It verifies ECDSA signatures only | Use the SDK's `SelfAgentVerifier` |
| `total_count` from `self_list_agents_for_human` looks wrong | It counts agents listed for that wallet, not all agents of the human | Use the [identify flow](/docs/agent-id/rest-api/#identify) and `agents-by-nullifier` |
| Local server exits with `Invalid SELF_AGENT_PRIVATE_KEY: ...` | The key isn't a `0x`-prefixed 32-byte hex secp256k1 key | Fix the key; an invalid network or API base also stops startup |
| `self_authenticated_fetch` refuses a host | Private, loopback and link-local targets are blocked (re-checked on each redirect, max 3) | Set `MCP_AUTH_FETCH_ALLOW_PRIVATE_NETWORKS=true` on the local server, and `MCP_AUTH_FETCH_ALLOWED_HOSTS` to allow-list hosts |
## Smart contracts
| Symptom | Cause | Fix |
| ------------------------------------------------ | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------- |
| Foundry build fails against Hub V2 | Hub V2 uses the `PUSH0` opcode | `forge build --evm-version cancun`, or `evm_version = "cancun"` in `foundry.toml` |
| `userDefinedData` looks garbled in your contract | The Self app passes it as a UTF-8 string, so `'0'` is `0x30`, not `0x00` | Parse ASCII characters, not raw bytes ([Registration data](/docs/agent-id/smart-contracts/#registration-data)) |
## Known limitations
- **Refresh:** agents without a stored config (`400`) or with an ID byte of `0x80`+ (`422`) must deregister and register again.
- **OFAC:** `requireOFAC()`, MCP `ofac_clear` and the card's `ofacClean` read only `ofac[0]`, which is `false` for non-passport documents.
- **Ed25519 deregistration:** on-chain only (`guardianRevoke` or `selfDeregister`), not through the API.
- **Replay cache:** in memory, per process. Behind several instances, a replay sent to a different instance isn't caught; add a shared check (for example on the signature) if that matters.
## Next
- [REST API errors](/docs/agent-id/rest-api/#errors)
- [Verification patterns](/docs/agent-id/verification-patterns/)
Read https://docs.self.xyz/docs/agent-id/troubleshooting.md so I can ask questions about this Self documentation page.
On this page
Find the exact error string in the table for the surface you’re using. Each row is symptom → cause → fix.
Scanning and proofs
| Symptom | Cause | Fix |
|---|---|---|
InvalidIdentityCommitmentRoot in the Self app | The document doesn’t match the network. Celo Sepolia takes mock passports only; Celo Mainnet takes real documents only | Start a session on the matching network. For testnet, use a mock passport: Settings → Manage ID documents → Generate Mock Document (guide). The CLI defaults to testnet; the SDK, A2A and MCP to mainnet |
Registered, but isVerified / verified is false | hasHumanProof is true but isProofFresh is false: the proof passed proofExpiresAt | Refresh in place: requestProofRefresh({ agentId, network }) or POST /api/agent/refresh |
| A contract accepts an expired agent | isVerifiedAgent() alone ignores expiry | Also check isProofFresh(getAgentId(key)) |
SDK and verifier
Errors from verifier.auth() (401 unless noted) and verifier.verify():
| Error | Cause | Fix |
|---|---|---|
Missing agent authentication headers | Signature or timestamp header missing (or stripped by a proxy) | ECDSA agents send x-self-agent-address, -signature, -timestamp. Ed25519 agents send x-self-agent-keytype: ed25519, x-self-agent-key, -signature, -timestamp |
Timestamp expired or invalid | Timestamps are unix milliseconds and valid for 5 minutes | Sync clocks; sign right before sending |
Invalid signature | The signed bytes differ from what arrived | Sign keccak256(timestamp + METHOD + pathWithQuery + keccak256(body)): path plus query, no host, the raw body |
Replay detected | The same signature was sent twice | Sign every request fresh |
Agent not verified on-chain | Key not registered on the verifier’s network, or deregistered. On a POST: a re-serialized or altered body makes ECDSA recover a different signer | Match the network (.network('testnet') for testnet agents; the default is mainnet). For POSTs, verify req.rawBody, not JSON.stringify(req.body) |
Agent's human proof has expired | proofExpiresAt has passed | Refresh the proof |
Agent was not verified by Self — proof provider mismatch | The agent’s proof came from another provider | Accept other providers with .requireSelfProvider(false), or register through Self |
Human has 3 agents (max 1) | The verifier allows 1 agent per human by default; the registry allows 10 on mainnet and no cap on testnet | .sybilLimit(n) for your policy, or .sybilLimit(0) for no limit |
Agent's human does not meet minimum age (required: 18, got: 0) | Registered without an age disclosure. Demo agents 1, 5 and 72 have none | Register with disclosures: { minimumAge: 18 } (or --minimum-age 18) |
Agent's human did not pass OFAC screening | Registered without ofac, or the document isn’t a passport (ofac[0] is false for ID cards and Aadhaar) | Register with ofac: true. Non-passport holders can’t pass requireOFAC() (known limitation) |
Missing agent key for Ed25519 verification | Manual verify() with keytype: 'ed25519' but no agentKey | Pass keytype and agentKey (the x-self-agent-key header) |
Invalid Ed25519 signature | Wrong key, or the signed message differs | Sign the same message as ECDSA agents, with the key in x-self-agent-key |
500 Raw request body unavailable for signature verification | A body arrived but req.rawBody is missing (the console logs a hint) | express.json({ verify: (req, _res, buf) => { req.rawBody = buf; } }), or express.text() / express.raw() |
503 Agent verification unavailable, try again later | The verifier’s RPC call failed | Retry, or set .rpc(url) |
CLI
| Symptom | Cause | Fix |
|---|---|---|
npx self-agent fails with an npm 404 | No npm package is named self-agent; the binary ships in the SDK | npx -p @selfxyz/agent-sdk self-agent ... |
wait times out although the human scanned | The session’s --network doesn’t match the network of the QR they scanned | Wait on the session file that produced the scanned QR, or init again with the right --network |
Last poll error: RPC call did not complete before the timeout | A short --timeout-seconds cut off the last poll (exit code 2) | Nothing is broken: run wait again, or raise --timeout-seconds |
Session expired. Run `register init` again. (exit code 1) | The session passed expiresAt (default --ttl-minutes 30) | Run init again |
--mode ed25519 is not supported by the CLI. Use linked or wallet-free, ... | The CLI supports linked and wallet-free only | Use requestRegistration({ mode }) or the REST API |
Export blocked. Re-run with --unsafe. | Export needs explicit consent | Add --unsafe plus --out-key <path> or --print-private-key |
| A flag seems to have no effect | Unknown flags are ignored silently, so typos fall back to defaults | Check the spelling against Commands and flags |
| Need another chain or deployment | --network knows only mainnet and testnet | Pass --chain, --registry and --rpc together |
REST API
| Response | Cause | Fix |
|---|---|---|
400 Missing session token. Provide Authorization: Bearer <sessionToken>. | The token wasn’t sent as a header (query-string tokens are ignored) | Send Authorization: Bearer <sessionToken> |
400 on a status route with a valid token | The token belongs to another flow (e.g. a registration token on /deregister/status) | Use the token from that flow |
401 Invalid session token | Truncated, altered, or from another deployment | Send the exact sessionToken from the latest response |
401 on /api/qr/... | A session token was used as a QR token | Use the scanUrl as returned |
409 Cannot export key until registration is complete. Current stage: qr-ready | The human hasn’t finished, or you sent an older token (the start token always says qr-ready). Ed25519 sessions get this too before completion | Poll status until completed, then export with the rotated token from that poll |
400 from export after completion | Ed25519 session: the agent already holds its key | Nothing to export |
409 on /api/agent/register/qr | The session is past qr-ready (already scanned) | Poll status instead |
410 Session expired | Sessions last 30 minutes; export works for 30 minutes after the poll that saw completed (repeatable inside it) | Start a new session. EVM-mode sessions can still be polled for up to 24 hours to catch a late scan |
400 This agent has no stored verification config ... on refresh | The agent was registered before config tracking (demo agents 1 and 5) or through an external provider | Deregister and register again |
422 on refresh | The 32-byte agent ID has a byte of 0x80 or more (e.g. IDs 128–255) | Deregister and register again, which mints a new ID (details) |
400 on POST /api/agent/deregister for an Ed25519 agent | Ed25519 agents aren’t deregistered with a scan | Guardian calls guardianRevoke(agentId), or the NFT owner calls selfDeregister(agentId) on the registry |
404 Agent not found | Never minted, burned, or the wrong chain | Check the chain ID in the path: 42220 mainnet, 11142220 testnet |
A2A lookup returns a completed task with data.error: "Agent not found" | Unknown agents are a result, not a failed task | Check data.error on completed tasks |
429 Rate limit exceeded. Try again later. | Per-IP limit; everyone behind one NAT shares it | Wait Retry-After seconds (or retryAfterMs); poll every few seconds. A2A reports JSON-RPC -32000. Limits |
502 RPC error | The API couldn’t read the chain | Retry. For a visa write, a 502 with txHash means it was broadcast: check on-chain before retrying |
Every status poll rotates the session token, so always send the latest one. Earlier tokens stay valid until expiry, so treat all of them as secrets. The SDK (waitForCompletion, exportKey) handles this for you.
Visa writes
| Response | Cause | Fix |
|---|---|---|
401 | Stale, reused or malformed signature | Sign a fresh timestamp (5 minutes, single use) over the exact message |
403 | The signer isn’t the NFT owner, the agent’s EVM key, or the wallet behind a wallet-based ID | Sign with one of those |
409 | The agent is already at or above targetTier | Nothing to do |
422 NOT_ELIGIBLE / REVIEW_REQUIRED | Metrics below the tier thresholds, or tier 3 needs an approved manual review | Improve the metrics, or request review first |
MCP
| Symptom | Cause | Fix |
|---|---|---|
406 Not Acceptable: Client must accept both application/json and text/event-stream | A raw request without the right Accept header | Send Accept: application/json, text/event-stream (MCP clients do this for you) |
405 on GET or DELETE | The hosted server is stateless Streamable HTTP | Use POST |
The client ignores .mcp.json | Missing mcpServers wrapper | { "mcpServers": { "self-agent-id": { "type": "http", "url": "https://agent-api.self.xyz/api/mcp" } } } |
Privileged tools (self_get_identity, self_sign_request, …) are denied | They act as the server’s own agent, which the hosted server doesn’t offer | Sign as your own agent with the local server and SELF_AGENT_PRIVATE_KEY, or run your own deployment with MCP_PRIVILEGED_API_KEY |
self_verify_agent fails for a human with several agents | max_agents_per_human defaults to 1 | Pass max_agents_per_human: 0 (no limit) or your cap |
self_verify_request can’t check an Ed25519 request | It verifies ECDSA signatures only | Use the SDK’s SelfAgentVerifier |
total_count from self_list_agents_for_human looks wrong | It counts agents listed for that wallet, not all agents of the human | Use the identify flow and agents-by-nullifier |
Local server exits with Invalid SELF_AGENT_PRIVATE_KEY: ... | The key isn’t a 0x-prefixed 32-byte hex secp256k1 key | Fix the key; an invalid network or API base also stops startup |
self_authenticated_fetch refuses a host | Private, loopback and link-local targets are blocked (re-checked on each redirect, max 3) | Set MCP_AUTH_FETCH_ALLOW_PRIVATE_NETWORKS=true on the local server, and MCP_AUTH_FETCH_ALLOWED_HOSTS to allow-list hosts |
Smart contracts
| Symptom | Cause | Fix |
|---|---|---|
| Foundry build fails against Hub V2 | Hub V2 uses the PUSH0 opcode | forge build --evm-version cancun, or evm_version = "cancun" in foundry.toml |
userDefinedData looks garbled in your contract | The Self app passes it as a UTF-8 string, so '0' is 0x30, not 0x00 | Parse ASCII characters, not raw bytes (Registration data) |
Known limitations
- Refresh: agents without a stored config (
400) or with an ID byte of0x80+ (422) must deregister and register again. - OFAC:
requireOFAC(), MCPofac_clearand the card’sofacCleanread onlyofac[0], which isfalsefor non-passport documents. - Ed25519 deregistration: on-chain only (
guardianRevokeorselfDeregister), not through the API. - Replay cache: in memory, per process. Behind several instances, a replay sent to a different instance isn’t caught; add a shared check (for example on the signature) if that matters.
Next
Was this page helpful?
Thanks. What went wrong?
Thanks for your feedback!