# Errors

> How the Webstory API and MCP tools report problems, what each error code means, and what an agent should do next.

Every error says what went wrong in a sentence a person or a model can act on, plus a short code your code can check.

## REST API

Errors come back with an HTTP status and a JSON body:

```json
{
  "error": "A sentence that says what went wrong.",
  "code": "machine_readable_code"
}
```

Check `code`, not the sentence. The sentences may be reworded; codes don't change without a note in the [changelog](/changelog).

## MCP tools

- **A problem with the request,** such as a story that doesn't exist or a role that doesn't allow it, comes back as a normal tool result marked as an error (`isError: true`). Its text is the sentence, and its structured content has the code in `error.code` and the sentence again in `error.message`. The model can read it and try something else.
- **A problem with the token** comes back as HTTP `401` with a `WWW-Authenticate` header, before any tool runs. Your client refreshes the token or signs in again. See [Authentication](/agents/authentication#errors-while-signing-in).
- **A scope the person didn't grant** comes back as HTTP `403` with `error="insufficient_scope"`. A call can also need a second scope: a [`replace_text`](/agents/tools/replace_text) dry run shows the story's words, so it needs `stories:read` too. Missing that one comes back as a tool error with the code `insufficient_scope` over MCP, and as `403` over REST.
- **A tool your connection can't use,** or that doesn't exist, gets the JSON-RPC error `-32602`, "There is no tool by that name."
- **A malformed message** gets a standard JSON-RPC error.

## Error codes

| Code | HTTP | What to do |
| --- | --- | --- |
| `invalid_arguments` | 400 | Names the argument, e.g. “story_id is required.”, “Unknown argument: x.”, “limit must be at most 50.” |
| `invalid_cursor` | 400 | That cursor isn’t valid. Ask again without one. |
| `invalid_destination` | 400 | Names what's wrong with the destination (see [`set_button`](/agents/tools/set_button)). |
| `invalid_change` | 400 | The draft wouldn't be valid any more, in the editor's words. |
| `not_saved` | 400 | The change would make the reel invalid; the sentence says why. |
| `unauthorized` | 401 | Send a Webstory access token in the Authorization header: Bearer &lt;token&gt;. |
| `invalid_token` | 401 | This access token is invalid, expired or revoked. Get a new one, or connect Webstory again. |
| `insufficient_scope` | 403 | This connection wasn’t allowed to do this. Connect Webstory again and allow “&lt;scope&gt;”. |
| `forbidden` | 403 | Your role in this workspace doesn’t allow this. |
| `agents_off` | 403 | Agents are turned off in this workspace. |
| `workspace_unavailable` | 403 | This workspace is being deleted. |
| `workspace_paused` | 403 | This workspace is paused, so agents can’t work in it right now. (The connection stays; it works again once Webstory unpauses the workspace.) |
| `storage_full` | 403 | This workspace has reached its plan’s storage limit. Free up space in the Library or upgrade the plan to add more. |
| `protected` | 403 | A story protected with a code, a password or an invite list, or one sharing a video or photo with one: agents can’t make preview links of it (see [`create_preview`](/agents/tools/create_preview)). |
| `plan_required` | 403 | Upgrade to sell through your stories. |
| `not_found` | 404 | Names what wasn't found. Another workspace's ids answer the same. |
| `effect_id_reused` | 409 | This effect id was already used for a different request. Use a new effect id for a new request. |
| `in_progress` | 409 | This request is still running. Send it again in a few seconds to get its result. |
| `not_live` | 409 | This story isn’t live yet, so its reels can’t be shared. |
| `story_busy` | 409 | This story is being handed over to another workspace right now. Try again in a minute. |
| `already_undone` | 409 | This change was already undone. |
| `not_undoable` | 409 | This change can’t be undone (an undo itself, more than 30 days old, or a story or reel another connection made): the sentence says which. |
| `gone` | 409 | What the change touched no longer exists; the sentence says what. |
| `reel_not_editable` | 409 | This reel’s design was made in the old canvas editor, so tools can’t change it yet. Change anything in it once in the reel editor to update it: &lt;address&gt; |
| `element_locked` | 409 | This button is locked in the editor. Someone on the team has to unlock it first. (Or: its position is locked.) |
| `place_not_supported` | 409 | This button moves with the picture or with its group, so it has no place on the screen to change. |
| `story_layer` | 409 | That button is on every reel of the story (the story layer). Tools change a reel’s own buttons. |
| `not_a_button` | 409 | That element isn’t a button. These tools change buttons only. |
| `conflict` | 409 | Something changed at the same moment (the reel saved in the editor meanwhile, or the story being handed over), or an undo found it changed since. The sentence says what; read it again and retry, or change it by hand. |
| `media_not_ready` | 409 | A library file has nothing to show yet (its upload didn’t finish). |
| `not_movable` | 409 | A move the story map doesn’t allow (see [`move_reel`](/agents/tools/move_reel)). |
| `not_removable` | 409 | Only reels this connection added, never published and still as it last left them can be removed by an agent (see [`remove_reel`](/agents/tools/remove_reel)). |
| `not_ready` | 409 | No preview yet: names the reels to wait for or fix (see [`create_preview`](/agents/tools/create_preview)). |
| `link_used` | 410 | The upload link a `create_upload` effect id made was already used or has expired: make a new one with a new effect id (see [`create_upload`](/agents/tools/create_upload)). |
| `too_large` | 413 | Media: the file is bigger than Webstory takes (names the limit). |
| `unsupported_file` | 415 | Media: this file isn’t a picture or video Webstory can use, with what Webstory takes. |
| `fetch_failed` | 422 | Media: Webstory couldn’t get the file, and why (what the address answered, a timeout, …). |
| `budget_exhausted` | 429 | A daily budget is used up, naming which and when it resets, e.g. This workspace’s agents have added today’s limit of 20 photos and videos. It resets at midnight UTC. |
| `rate_limited` | 429 | Too many requests from this agent. Try again in N seconds. (Or: too many agent requests in this workspace.) |
| `daily_limit` | 429 | This workspace’s agents have reached today’s limit of 5,000 requests. It resets at midnight UTC. |
| `internal` | 500 | Something went wrong on Webstory’s side. Try again in a minute. |
| `unavailable` | 503 | Webstory can’t take agent requests right now. Try again in a minute. |
| `agents_stopped` | 503 | Webstory has paused all agent access for now. Try again later. |

## Things that look like errors

- **Not found, though you know it exists.** Anything outside the connection's workspace answers as not found, on purpose: an agent can't tell whether another workspace's story exists. Check that the person connected the right workspace.
- **Not allowed, though it worked yesterday.** The person's role may have changed. Roles are checked on every request.
- **Signed out.** The connection ended. For example, the person or an Owner or Admin disconnected it, agents were turned off for the workspace, it wasn't used for 90 days, or the person left the workspace. Connect again.

## Per-tool errors

Each tool's page lists the errors it can return beyond the ones above. See the [tool reference](/agents/tools).

Source: https://docs.webstoryapp.com/agents/errors
