# Error codes

Tool calls that fail return an `{"error": "...", "code": "..."}` payload. The `code` is stable and safe to switch on.

## Auth and quota

| Code                   | Meaning                                                                                                                                       |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `insufficient_credits` | Organization credit balance is too low to start generation.                                                                                   |
| `rate_limited`         | Per-user rate limit exceeded — see [Credits and limits](/perceptis-mcp-server/credits-and-limits.md). Payload includes `retry_after_seconds`. |

HTTP `401` (no body) means the bearer API key is missing, invalid, or revoked, or the OAuth session has expired.

## Lookup failures

| Code                 | Meaning                                                                                                          |
| -------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `template_not_found` | The template id does not exist or is not accessible to your organization.                                        |
| `session_not_found`  | Session id does not exist or belongs to a different user.                                                        |
| `deck_not_found`     | Deck id does not exist or belongs to a different user.                                                           |
| `slide_not_found`    | Slide number is out of range for the deck.                                                                       |
| `org_not_found`      | The authenticated user has no active organization.                                                               |
| `missing_parameter`  | A required id (`session_id` or `deck_id`) was not supplied to `check_generation_status` or `show_slide_preview`. |

## Generation state

| Code                  | Meaning                                                                                                        |
| --------------------- | -------------------------------------------------------------------------------------------------------------- |
| `generation_failed`   | The underlying generation workflow failed. The session/deck cannot be recovered; start a new one.              |
| `session_empty`       | The session has no slides or successful versions yet.                                                          |
| `storyline_not_ready` | `render_deck` was called before the storyline phase finished. Poll `check_generation_status(deck_id=…)` first. |
| `render_not_complete` | `export_deck` was called before all slides finished rendering. Poll first.                                     |
| `deck_not_rendered`   | `edit_deck_slide` was called against a deck that has not been rendered yet.                                    |
| `artifacts_failed`    | `show_slide_preview` could not fetch the rendered PNG from storage. Retry; if persistent, regenerate.          |
| `export_timeout`      | The `.pptx` merge workflow did not finish within the polling window. Retry `export_deck`; it is idempotent.    |


---

# Agent Instructions: 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:

```
GET https://docs.perceptis.ai/perceptis-mcp-server/errors.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
