> For the complete documentation index, see [llms.txt](https://nexafin.gitbook.io/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nexafin.gitbook.io/api/mcp/errors.md).

# Error Codes

All errors follow the [JSON-RPC 2.0](https://www.jsonrpc.org/specification#error_object) error format:

```json
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32001,
    "message": "Authentication required"
  },
  "id": 1
}
```

## Standard JSON-RPC errors

| Code     | Name             | Description                                           |
| -------- | ---------------- | ----------------------------------------------------- |
| `-32700` | Parse error      | Invalid JSON in the request body                      |
| `-32600` | Invalid request  | The request is not a valid JSON-RPC request           |
| `-32601` | Method not found | The requested method does not exist                   |
| `-32602` | Invalid params   | Invalid tool arguments or missing required parameters |
| `-32603` | Internal error   | Unexpected server error                               |

## Nexafin MCP errors

| Code     | Name                  | HTTP Status | Description                                         |
| -------- | --------------------- | :---------: | --------------------------------------------------- |
| `-32001` | Authentication error  |     401     | Missing or invalid OAuth token                      |
| `-32002` | Authorization error   |     403     | Token is valid but account is not linked to Nexafin |
| `-32003` | Tool execution error  |     500     | The tool encountered an error during execution      |
| `-32004` | Rate limit exceeded   |     429     | Too many requests — check `Retry-After` header      |
| `-32005` | Subscription required |     403     | An active PRO subscription is required              |

## HTTP status codes

| Status | Meaning                                                                                   |
| ------ | ----------------------------------------------------------------------------------------- |
| `200`  | Success                                                                                   |
| `400`  | Parse error or invalid request                                                            |
| `401`  | Authentication required — includes `WWW-Authenticate` header                              |
| `403`  | Authorization error — account not linked, subscription inactive, or subscription required |
| `404`  | Method not found, or MCP is disabled                                                      |
| `429`  | Rate limit exceeded — check `Retry-After` header                                          |
| `500`  | Internal server error                                                                     |


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://nexafin.gitbook.io/api/mcp/errors.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
