# Troubleshoot agent calls

Errors and surprises an agent meets when it drives Mirli over MCP, and what to do about each. For a person setting up
a connection, see [Connect an AI agent to Mirli](https://mirli.app/docs/connect-agent/index.md#troubleshoot-the-connection).

## Connection

| Symptom | Cause | What to do |
|---|---|---|
| The client cannot connect | Mirli is not running, or the URL is wrong | Ask the user to open Mirli. Use the address on the **Agents** page, with no trailing slash |
| `403` with `Forbidden host` | The client reached `/mcp` by a host name the server does not accept | Add the name to `MIRLI_ALLOWED_HOSTS` on the server. See [MCP transports](https://mirli.app/docs/mcp-connect/index.md#access-token-and-allowed-hosts) |
| `401`: "This Mirli needs its access token" | The server has an access token | Send `Authorization: Bearer <TOKEN>`, or set `MIRLI_API_TOKEN` for the stdio bridge |
| Only six tools are listed | The client uses the stdio bridge | Connect over Streamable HTTP for speech, stories and the studio |
| Results have a `url` but no `path` | The stdio bridge returns the HTTP API's objects | Connect over Streamable HTTP |

## Generating

| Symptom | Cause | What to do |
|---|---|---|
| "No local model is installed yet" | The user has not downloaded a model | Tell the user to download one on the **Models** page. Retrying gives the same error |
| "No free model is installed, and metered models ... are never picked by default" | Only models that bill per render are installed | Name one as `model` only if the user agrees to the cost |
| `duration_s` refused | It is greater than the model's `max_duration_s` | Read `max_duration_s` in `list_models` and ask for less, or pick another model |
| An `edit` fails | The model's `supports` flag for that edit is false | Pick a model with `supports.extend`, `supports.cover` or `supports.repaint` |
| `lyrics` has no effect | The model's `supports.lyrics` is false | Pick a model that takes lyrics |
| The call times out in the client | A long render outlasted the client's timeout | Send `_meta.progressToken`, raise the client's tool timeout, or ask for a shorter `duration_s` |
| Parallel calls finish one after another | Mirli runs one job at a time | Use `variations` for several takes of one prompt |
| `enhance_prompt` returns a sentence, not JSON | The user's prompt assistant is off | Pass the sentence to the user, or write the prompt yourself |

## Speech and stories

| Symptom | Cause | What to do |
|---|---|---|
| A line says its stage direction aloud | The direction is in `text` | Move it to `delivery`, with names from the model's `delivery` list |
| A `delivery` setting changes nothing | The name is not one the model takes | Use only names from `list_models`. Unknown names are ignored without an error |
| A voice does not sound like itself | Its model was not installed, so another model read the line | Read the result's `notes` and tell the user |
| New lines play on top of each other | Lines appended to a lane with audio share one `start_s` | See [Add lines to a story that already has audio](https://mirli.app/docs/agents-story-calls/index.md#add-lines-to-a-story-that-already-has-audio) |
| A changed line still sounds the same | Changing `text` or `delivery` does not re-read it | Call `speak_story` again |
| `split_line` fails | The line has not been read, or `at_s` is outside the clip | Read it first, and pass a point inside the clip as it plays |
| The export has no effects | The devices are bypassed, or the export ran before they were added | Check the lane's chain with `get_story`, then export again |

## The open studio

| Symptom | Cause | What to do |
|---|---|---|
| "No studio is open in Mirli" | No studio page is open | Ask the user to open one, or use the story tools on the saved story |
| "*N* studios are open" | Several studios are open and no `story_id` was passed | Pass `story_id`; the error lists the open ones |
| `dropped` is more than 0 | An action named a clip, lane, voice or effect that is not in the studio, or was malformed | Call `studio_context` and use only its ids |
| `held_deletes` is more than 0 | `allow_delete` was not set | Ask the user, then send the deletes again with `allow_delete: true` |
| New clips are not there yet | `generate_clip` and `speak_lines` run in the background | Call `studio_context` again after a few seconds |

## Report a problem

To report a bug, include the tool name, its arguments and the error text. The **Agents** page lists every call with
its arguments and error; click a row under **Recent calls** to see them.
