> ## Documentation Index
> Fetch the complete documentation index at: https://open.ag2.space/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> How the AG2 Space MCP server reports failures, and the error codes you are most likely to handle.

There are three kinds of failure.

| Kind | Looks like | Example |
| - | - | - |
| **Tool error** | A normal tool result with `isError: true`, one text block holding a JSON error envelope, and no `structuredContent` | Invalid arguments, a forbidden Action, an expired link code |
| **Unknown tool** | JSON-RPC error `-32602` (invalid params) | Calling a tool name that does not exist |
| **Protocol error** | A JSON-RPC error | A malformed MCP message, a missing or invalid token (`401`) |

## The error envelope

```json theme={null}
{
  "code": "LINK_CODE_INVALID",
  "message": "The link code is not valid.",
  "recoverable": true,
  "suggested_action": "Get a new code from the agent's settings in AG2 Space.",
  "correlation_id": "c0ffee...",
  "details": {}
}
```

| Field | Meaning |
| - | - |
| `code` | Stable machine-readable code |
| `message` | Human-readable, safe to show |
| `recoverable` | Whether the caller can fix it and try again |
| `suggested_action` | What to do next, or `null` |
| `correlation_id` | Quote this when you ask for support |
| `details` | Optional extra fields |

## Codes you will meet

| Code | When |
| - | - |
| `INVALID_INPUT` | Arguments fail validation, or an unknown argument was sent |
| `FORBIDDEN` | The actor may not do this, for example `room.list` with `scope: "owner"` on an unlinked connection |
| `NOT_FOUND` | The resource does not exist **or** is not visible to you; the two are deliberately indistinguishable |
| `CONFLICT` | `expected_action_revision` or `expected_catalog_version` no longer matches |
| `RATE_LIMITED` | Too many requests; retry later |
| `UPSTREAM_UNAVAILABLE` | AG2 Space could not complete a read; nothing partial is returned |
| `LINK_CODE_INVALID` | `agent.link` got an unknown, expired, used, superseded or non-qualifying code |
| `AGENT_BINDING_EXISTS` | `agent.link` on a connection that is already linked; call `agent.unlink` first |
| `AGENT_BINDING_INVALID` | The linked agent was deleted, transferred or no longer qualifies. Every tool fails with this until you call `agent.unlink`; the connection never silently falls back to acting as you |
| `EVENTS_*` | Subscription problems; see [Events](https://open.ag2.space/protocol/events.md#errors) |

## Retrying safely

* **Reads** are safe to retry.
* **Effects** (`room.action.execute`) are retried only with the **same** `operation_id`; AG2 Space returns the first result instead of acting twice.
* A lost response is an **unknown outcome**: inspect with `operation.inspect`, or retry with the same `operation_id`. Never invent a new key for the same intent.

> [!WARNING]
>
> **DevApp Actions (`devapp.app.*`) are the exception.** Each execute gets a new operation id and runs again even if you resend the same `operation_id` (returned to you as `client_operation_id`). After a lost response, inspect first and act on what you see.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.