> For the complete documentation index, see [llms.txt](https://docs.metamynd.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.metamynd.ai/get-started/troubleshooting.md). Agents can also search and read this documentation through its [MCP server](https://docs.metamynd.ai/~gitbook/mcp).

# Troubleshooting

Look up the reason code on a refused request and fix the cause. A refusal never runs your tool, so it is safe to retry once fixed.

Every refusal carries a reason code. Find it here, fix the cause, and try again. A refusal never runs your tool, so it is always safe to retry once the cause is fixed.

{% embed url="<https://youtu.be/F5PcoWJcrvo>" %}

Where to find the code:

* **agentsafe-guard (Node):** the thrown `GovernanceBlocked` error carries `err.governance.reasonCode`, and `err.governance.hint` when there is one.
* **metamynd-client (Python):** `GovernanceBlocked.reason_code`, or the refusal your framework hands back to the model.
* **Direct HTTP:** `data.reasonCode` in the response body. Branch on the code and the HTTP status, never on message wording.
* **Dashboard:** every gate decision is in **Operations → Activity Log**, with its reason and the rule that decided it. **Reporting → Decision Explorer** shows each decision with its authorisation, approval, execution and evidence as separate stages.

This page covers the codes developers meet most often. Every other code is listed, with its meaning, in the [Reason Code Registry](https://docs.metamynd.ai/agent-protocol/reason-code-registry).

### The request never reached a rule

#### `MALFORMED_REQUEST`

The request body failed validation before any rule ran. The response's `data.issues` names the field. Common causes:

* A required field is missing: `agentDid`, `action`, `nonce`, `issuedAt` or `signature`.
* `context` was sent as `null`. Leave it out, or send `{}`, when there is nothing to send; `null` is not "no context".
* A negative amount, or a `jurisdiction` that is not two letters.

#### `SIGNATURE_INVALID`

The signature does not match the request. The response's `hint` lists the usual causes:

* The agent key must be the DER PKCS#8 hex from `agent.metamynd.json`, not a raw 32-byte seed.
* Amounts are signed the way JavaScript prints them: `150.0` signs as `150`.
* Every signed field, `issuedAt` especially, must be the same string in the signature and the body. Format the timestamp once.
* The request was changed after signing (an amount, merchant or `agentDid` edited in transit). That is the refusal working as intended.

Use the SDK's `buildSignedRequest` or `guardTool` rather than signing by hand; both get these details right.

#### `REPLAY_DETECTED`

The request's `nonce` was already used. Build a new signed request for every call; the SDKs do this for you. Resending a captured request is refused by design.

#### `REQUEST_EXPIRED`

`issuedAt` is outside the freshness window. Sign just before sending, and check the clock on the machine running the agent.

#### `CONTEXT_SIGNATURE_INVALID`

The context (`itinerary`, `trace`, `materiality`) was changed after the agent signed it, or signed with another key. Do not edit the context after `buildSignedRequest`.

#### `CONTEXT_SIGNING_UNSUPPORTED`

Raised by the SDK before sending: the key provider cannot sign the request's context. Upgrade the signer daemon, or pass `signContext: false`.

### The agent's authority does not cover it

#### `NO_MANDATE`

The agent has no mandate. Set one on the agent's Trust Profile: **Agents → Agent Identities**, open the agent, **Authority** tab, **Set mandate**.

#### `AGENT_NOT_FOUND`

No agent is registered under this `agentDid`: it is mistyped, malformed, or belongs to another environment (a Testnet DID sent to a different server). Check `agentDid` matches the one in `agent.metamynd.json`.

#### `NO_PERMISSION_FOR_ACTION`

The mandate does not grant this action key. The action in your code (for example `invoice.pay`) must match the mandate's action exactly. To allow a new action, grant it on the agent's page; do not relabel the call.

#### `MANDATE_REVOKED`

The owner revoked the mandate. Every new request is refused, and so is any authorization that was granted before the revocation but not yet carried out. Issue a new mandate to let the agent act again.

#### `MANDATE_EXPIRED`

The mandate is outside its validity window. The owner can set a later end date (or remove it) on the agent's **Authority** tab under **Expiry** with **Change expiry**, or issue a new mandate.

#### `MERCHANT_NOT_ALLOWED`

The merchant or recipient is not on the mandate's approved list. If it should be allowed, add it to the mandate. For a spending mandate, the owner does this on the agent's **Authority** tab under **Spending limits** with **Change limits**. Note that the list is matched exactly.

#### `JURISDICTION_REQUIRED`

The mandate or a rule restricts jurisdictions, and the request signed none. Pass `jurisdiction` (a two-letter ISO code such as `GB`) to the guard so it is signed with the request. A `jurisdiction` inside `context` is ignored.

### A limit or rule stopped it

#### `SOP_SPEND_CAP`

The amount is over the per-transaction cap set by the agent's rules.

#### `CURRENCY_NOT_ALLOWED`

The request's `currency` is not the currency of a cap that applies to it: the mandate's spend limit or a currency-scoped rule. An amount in another currency cannot be compared with the cap, so the request is refused whatever the amount. Send the request in the cap's currency, or ask the owner to add the currency to the mandate and its rules.

#### `SOP_BUDGET_CAP`

Spend already committed plus this amount is over the total budget. Holds count toward the budget until they are captured or released.

#### `CAP_EXCEEDED`

The budget ran out between the rule check and the moment the hold was written, almost always because concurrent requests took the rest of it. It is the same exhausted budget as `SOP_BUDGET_CAP` (or `SPEND_LIMIT_EXCEEDED` for the mandate's own limit), met by a different control: requests sent one at a time get those codes, requests that race get this one. The budget is enforced exactly under concurrency. Retry once spend is released, or raise the budget.

#### `PAYLOAD_BINDING_REQUIRED`

The mandate requires the agent to sign the exact payload it will execute, and the request carried none. Return a `payload` from your argument mapping, for example `payload: { merchant, amount, currency }`. The framework examples omit it because most mandates do not require it.

#### `PAYLOAD_BINDING_INVALID`

A payload digest was sent without a valid signature, or in the wrong format. Let the SDK compute it from `payload` rather than setting `payloadDigest` yourself.

### It was sent to a person for review

An escalation is not an error. The tool did not run, and the owner decides in **Operations → Escalations**. Once approved, call `resume(escalationId, sameArgs)`; the guard runs the tool once with the approved values.

#### `RISK_REVIEW`

The effective risk level is at or above the rules' threshold. The effective level is the higher of what the agent declared and what MetaMynd derives itself: an amount close to the per-transaction cap is treated as high risk even when the agent says `low`.

#### `CONTEXT_UNVERIFIABLE`

A rule needed a context field, usually `riskLevel`, and the request did not send a valid one. Send `riskLevel` (`low`, `medium`, `high` or `critical`) in `context`. The owner can also set a risk floor on the mandate so it does not depend on the agent.

#### `SPEND_PATTERN_ANOMALY`

The amount is unusual for this agent's own history, so it is held for review, not refused. Amounts the mandate's per-transaction cap already bounds are not re-checked.

To fix it, approve the payment in **Operations → Escalations** if it is expected; the agent's `resume()` then runs it, and approved payments join the history later ones are compared with. A new agent tested with very small amounts has a very small baseline, so test with realistic amounts. The check is listed on the deploy review as **Spend-pattern review**.

#### `ESCALATION_REQUEST_MISMATCH`

`resume()` was called with arguments that differ from the request the owner approved: a different amount, merchant, payload or context. Resume with the original arguments; the approval is left in place for them.

#### `AUTHORIZATION_ALREADY_USED`

The approved request has already run, been claimed by a gateway, or expired. An approval runs exactly once.

### The gateway or MCP guard refused it

These come from the service in front of your tool (agentsafe-http-gateway, agentsafe-mcp-guard), not from the gate.

#### `MISSING_GOVERNANCE`

HTTP 401: the call to a governed route carried no signed request. Inside a `guardTool` handler, send `await decision.governanceHeaders()` as the request headers.

#### `PAYLOAD_NOT_BOUND`

The body sent to the gateway is not the payload the agent signed. Send exactly the object you returned as `payload`; do not change the amount, merchant or any field after approval.

#### `PAYLOAD_UNBINDABLE`

The body has fields the route does not allow, or the governed fields (`amount`, `currency`, `merchant`) are not at the top level. Send only those fields, or list extra ones in the route's `allowedFields`.

#### `GATEWAY_ACTION_MISMATCH`

HTTP 403: the request was signed for a different action than the one this gateway route serves. The response names both (`action` and `signedAction`). Call the route for the action you signed, or sign with the route's action. Nothing was claimed. Gateways before 0.29.0 reported this as `SIGNATURE_INVALID`.

#### `QUERY_NOT_BOUND`

The URL carries a query string that the signature does not cover. Put values in the signed body. A route can list harmless keys (paging, sorting) in `allowedQuery`.

#### `AGENT_NOT_ADMITTED`

The gateway does not serve this agent. Add the agent's DID to the gateway's `allowedAgents` (`AGENTSAFE_ALLOWED_AGENTS`).

#### `GATEWAY_OWNER_MISMATCH`

The agent belongs to a different owner than the one the gateway acts for. Set `gatewayOwnerPrincipal` (`AGENTSAFE_GATEWAY_OWNER`) to the agent owner's principal DID, shown in the agent's public manifest.

#### `COUNTERPARTY_NOT_REGISTERED`

The owner has restricted who may carry out the agent's actions, and this gateway is not on the list. In the dashboard, open **Authority & Controls → Trusted Counterparties**, enter the gateway's `serviceDid`, click **Get acceptance challenge**, and have the gateway sign the challenge with `guard.acceptCounterpartyChallenge(message)`.

#### `AUTHORIZATION_ALREADY_CLAIMED`

The authorization was already used by a gateway. Each authorization runs once; get a new one for a new call.

#### `CREDENTIAL_UNAVAILABLE`

HTTP 502: the gateway's credential source released no credential for this route, so nothing was sent upstream. Check the gateway's credential configuration.

#### `UPSTREAM_UNREACHABLE`

HTTP 502: the call was permitted, but the gateway could not connect to the upstream service (connection refused, host not found, or connect timeout), so nothing was sent and nothing ran. The response says `executed: false`, and the hold the call claimed is released, so the budget is back. Start the upstream or fix `AGENTSAFE_UPSTREAM`, then retry. Gateways before 0.32.2 answered `GATEWAY_ERROR` and left the hold unknown (`RESPONSE_LOST`, below).

#### `RESPONSE_LOST`

Shown in the Activity Log as the reason for a hold whose effect is **unknown**, often with the executor's reason appended: `RESPONSE_LOST:UPSTREAM_ERROR` (the upstream failed without an HTTP answer) or `RESPONSE_LOST:UPSTREAM_HTTP_503` (it answered with a status not known to mean "nothing happened"). The gateway cannot tell whether the upstream acted, so the amount stays committed to the budget and the hold cannot be captured or released. Ask for reconciliation (`POST /policy/mandate/authorize/:authId/effect/reconcile`, by the gateway, the owner or an admin); it settles on what the remote system reports. If your upstream guarantees that certain statuses mean nothing ran, list them in the gateway's `releaseOnStatus` so those calls are released instead.

#### `AUTHORIZATION_CONTEXT_REQUIRED`

The gateway is too old to run a request a person approved. The `detail` names the version to upgrade to. The approval is kept, so resume again after upgrading.

#### `POLICY_BUNDLE_UNVERIFIED`

The gateway has no pinned policy key and fetched the policy over plain HTTP. Set `AGENTSAFE_POLICY_PUBLIC_KEY` to the value from `GET /magp/policy/pubkey`.

### MetaMynd could not be reached

#### `GATE_UNREACHABLE`

The SDK could not reach MetaMynd, so it refused the call rather than let it run unchecked. Check network access to `https://metamynd.ai/api/v1` and retry. Your tool did not run.

### The agent is contained

#### `AGENT_SUSPENDED`

#### `AGENT_QUARANTINED`

The agent was contained by a rule or by its owner. It can act again only after the owner clicks **Reinstate**, on the agent's row under **Agents → Agent Identities** or at the top of its Trust Profile.

#### `AGENT_DECOMMISSIONED`

The owner decommissioned the agent: it is permanently retired, its mandates were revoked and the gate refuses everything it asks. It cannot be reinstated. Deploy a new agent to take over its work.

### Not a reason code

**Requests sometimes take 15 seconds or more.** The Python client waits up to 15 seconds per attempt by default. If calls are consistently slow, check the network path to `metamynd.ai`, and report the request's time and agent DID to support.

**`agent.metamynd.json` has no key after downloading it again.** By design. A MetaMynd-managed key is delivered once, at deploy. If you lost it, use **Rotate key** on the agent's Trust Profile (**Identity** tab, **Network identities** panel), which issues a new one.

**The quickstart says "Integration verified: Not yet".** No request from your software has reached MetaMynd. It turns green once the first request arrives.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.metamynd.ai/get-started/troubleshooting.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
