# Troubleshooting

Fixes for the problems people actually hit, from installation and model keys to empty answers, RAG quality, agents, sandbox, triggers, MCP and deployment.

Source: https://glamorous-boar.cloudvent.net/troubleshooting/

---

**First, look at the evidence.** Most problems are explained by one of these:

1. **Problems** tab: validation diagnostics with codes and hints.
2. **Trace** tab: which node failed, its `error.code` and message, retries and skips.
3. **Inspector → Last run** on the failed node.
4. The terminal running `npm run dev`: API logs.

Then find the code in [Error codes](/error-codes/) or the symptom below.

## Installation and start-up

### `npm run dev` says a port is in use
Another program holds 8000 or 5173. Use the suggested free port: `npm run dev -- --web-port 5174 --api-port 8001`. Or stop the old servers with `npm run stop`.

### `uv: command not found`
Install uv from docs.astral.sh/uv, open a new terminal, re-run `uv sync`.

### `uv sync` fails building a package
Check Python is 3.11+ (`python --version`). On Windows some wheels need the latest pip toolchain; re-run `uv sync`. Milvus Lite is not published for Windows and is skipped automatically.

### The IDE loads but shows errors fetching data
The API is not running or crashed. Check the terminal; `curl http://127.0.0.1:8000/api/health` should answer. If you started the servers separately, start `npm run dev:api` too.

### I edited `.env` and nothing changed
The API reads `.env` at start-up: restart it (Ctrl+C, `npm run dev`). Keys in Settings → Secrets need no restart. Note that environment variables win over the secret store.

### The browser keeps asking me to sign in / sessions mix between instances
Only with `AGENTICMIND_AUTH=required`. Cookies are named per port (`am_session_<port>`); after upgrading everyone signs in once more. Behind HTTPS set `AGENTICMIND_COOKIE_SECURE=1`.

## Model calls

### `PROVIDER_AUTH_MISSING` or `SECRET_NOT_CONFIGURED`
The secret named in the node's `api_key` is not set. Add it to `.env` (then restart) or Settings → Secrets. Check the exact name: `OPENROUTER_API_KEY`, not `OPENROUTER_KEY`.

### `PROVIDER_AUTH_FAILED`
The key is wrong, revoked, or for another provider. Make sure `provider` matches the key (an OpenRouter key does not work with `provider: openai`).

### `PROVIDER_INSUFFICIENT_CREDITS`
Top up the provider account.

### `PROVIDER_BAD_REQUEST`
Usually a wrong model ID for that provider. OpenRouter IDs look like `google/gemini-3.8-flash`; native providers use their own IDs; Azure uses your deployment name. Use Settings → Wingman → **Browse** to see valid IDs.

### Empty answers (`MODEL_EMPTY_RESPONSE`) or cut-off answers (`MODEL_OUTPUT_TRUNCATED`)
Reasoning models spend part of `max_tokens` thinking. Raise `max_tokens` to 1024–4000, or set `reasoning_effort` to `low`. This is the most common problem with Gemini 3.x and other thinking models.

### Answers are slow
- Reasoning models think before the first visible token (tens of seconds is possible): lower `reasoning_effort` on simple nodes.
- Agents: each turn is a model call. Fewer tools, clearer tool descriptions, parallel tool calls and smaller models for workers help. Inspect the trace for retries and repeated delegations.
- Ollama on CPU is slow for large models: use a smaller model.

### `PROVIDER_REFUSED`
The model declined (Anthropic refusal or Gemini safety block). Rephrase the prompt or try another model.

### Ollama: connection error
Start it with `ollama serve`, pull the model (`ollama pull llama3.2`), and keep `base_url` at `http://localhost:11434/v1` (or your host).

### Cost shows as unknown
Only OpenRouter reports per-call cost. Native providers report tokens only, so cost budgets do not apply there.

## RAG

### `COLLECTION_NOT_FOUND` when asking a question
The index does not exist yet: run **Run → Index report** first.

### `NO_FILES` / `NO_TEXT_EXTRACTED`
Select files in the Document Loader. For scanned PDFs keep `ocr: auto`. Encrypted PDFs (`PARSE_ENCRYPTED`) must be decrypted first.

### `EMBEDDING_DIMENSION_MISMATCH`
You switched to an embedding model with a different vector size. Turn on `recreate` in Index Documents for one run (then turn it off).

### `EMBEDDING_MODEL_MISMATCH`
The query flow uses a different Embedding Model node than ingestion. Connect the same node to both.

### The first run hangs for a while
The local embedding model (~65 MB), the reranker (~80 MB) or OCR models are downloading once. Check your network; later runs are fast.

### Answers say "I don't know" but the answer is in the document
Work through retrieval first:
1. Run **Run → Results** (or look at the `retrieved` trace event) to see what was retrieved.
2. If the right chunk is missing: try **Hybrid Search** (exact terms), a **Query Rewriter**, a larger `top_k`, a different chunking strategy (`layout` or `markdown` for structured docs), or `parent_child`.
3. If the right chunk is retrieved but ranked low: add the **Reranker**.
4. If it is retrieved but the model still says no: raise Context Builder's `token_budget`, check `score_threshold` is not filtering it out, try a stronger model.
5. Measure with the [Evaluation Lab](/evaluation/) so you know a change helped.

### Citations are missing or wrong
Keep the Context Builder instructions that ask for `[n]` citations. `remove_invalid` drops citations to non-existent sources. Citation validation checks existence, not support: use the groundedness judge to measure support.

### Old content still appears after I deleted a file
Deleting a source document does not remove its chunks from the index. Run ingestion once with `recreate` on.

## Agents

### `AGENT_LIMIT_REACHED`
The agent used all its turns, tool calls, tokens or budget. Look at the trace: is it looping on a failing tool? Improve the tool's description, raise the limit, or set `on_limit: return_partial`.

### The agent does not use a tool it should
Make the tool's `description` say exactly when to use it. Mention the tool in the Agent's `instructions`. Very low `reasoning_effort` can make models skip tools (for example the clock).

### Web Fetch returns 403
Many sites (Wikipedia among them) refuse automated clients without contact details. Set `AGENTICMIND_HTTP_USER_AGENT=MyAgents/1.0 (https://your-site; you@example.org)` and restart. Bot-policy refusals are marked permanent, so the agent will not retry them in the same run.

### Web Fetch says the domain is not allowed
Add it to `allowed_domains` (subdomains are included).

### `TOOL_PERMISSION_DENIED` with MCP or Code Interpreter
Your Agent (or Tool Router / Tool Chain) node is an older version without the `subprocess` permission. Replace it with the latest version from the library.

### Sub-agents keep getting re-delegated
Fixed in current versions: permanent tool failures are shared across the supervisor and its sub-agents. Make sure you use the latest Agent and Subagent nodes.

## Code execution

### `SANDBOX_UNAVAILABLE`
Docker is not running or not installed. Start Docker Desktop, or for trusted local code set `AGENTICMIND_SANDBOX=process` and restart.

### `ModuleNotFoundError` in the Code node
Only the standard library is available. Build an image with the packages and set `AGENTICMIND_SANDBOX_PYTHON_IMAGE`.

### The first code run is slow
The Docker image is being pulled once.

## Human approval

### The run is stuck as waiting
That is by design: open the **Approvals** tab and approve or reject. Waiting runs hold no resources and survive restarts.

### `SUSPEND_IN_LOOP`
Move Human Approval outside the loop body.

## Triggers

### The trigger panel says not ready
It lists what is missing: usually a secret. Add it, then save again.

### Webhook returns 404
The trigger is not enabled in the latest **saved** revision. Tick `enabled` and save.

### Webhook returns 401/403
Wrong token or signature. For `token` send `Authorization: Bearer <secret>`; for `hmac` sign the raw body with HMAC-SHA256 and send `sha256=<hex>` in the configured header.

### Slack, Telegram or WhatsApp never reach my bot
They need a public HTTPS URL. Run a tunnel (cloudflared, ngrok) to port 8000 and register the tunnel URL shown in the Trigger panel.

### A schedule did not fire while the server was off
Missed schedules are not replayed after a restart.

## MCP

### My exposed workflow does not appear in the MCP client
Tick **Expose as MCP tool** and **save**. Check the client URL is `http://localhost:8000/api/mcp`, and if `AGENTICMIND_MCP_TOKEN` is set, that the client sends the bearer token. Requests with an unexpected Host header are refused (`AGENTICMIND_MCP_ALLOWED_HOSTS`).

### `MCP_CONNECTION_FAILED` with a stdio server
Run the same `command` and `args` in a terminal to see its error (missing `npx`/`uvx`, package name typo). Secrets go in `secret_env`, not `env`.

## Evaluation

### Retrieval metrics show not applicable
The cases need `expected_sources`, and the answer must depend on a retrieval node (or name one in the config).

### Judge metrics are empty
Choose a judge model and its secret in the Run tab. A judge failure is shown as not applicable with the error.

### Runs are flagged not comparable
The dataset version, K or judge differs between the two evaluations. Re-run with matching settings.

## Export and deployment

### The exported app answers 503
Set `APP_API_KEYS` in the app's `.env`; protected endpoints fail closed without keys.

### Local Docker deploy is disabled
Set `AGENTICMIND_LOCAL_DEPLOY=1` and restart. The graph's secrets must be in the server's environment too.

### Cloud Run or Vercel is blocked
The graph stores data on disk (Index Documents with an embedded vector store). Use a server or cloud vector store, or a target with volumes (Docker, Kubernetes).

### `GIT_REMOTE_CHANGED`
Someone changed the project file on GitHub. **Pull** first, or **Push anyway** to add your version on top.

## Still stuck?

Collect the run's trace (Trace tab → download OTLP/JSON), the error code and the API log lines, and open an issue on the [GitHub repository](https://github.com/taeefnajib/AgenticMind/issues).
