Request a demo
Docs / Troubleshooting / Tool failures

Tool failures

A "tool failure" is when the agent calls a tool, the tool returns an error, and the agent surfaces that error in the conversation. This page covers the most common ones and how to fix them.

File-system tools

read_file: ENOENT — file not found

The path doesn't exist or has a typo. Check with ls first. Note: the agent uses paths relative to the working directory unless you give it an absolute path.

edit_file: old_string not found in file

edit_file replaces an exact piece of text. If the file changed after the agent read it, or the agent quoted the text inexactly, the edit is rejected. The agent normally re-reads the file and retries — this is fine once or twice; if it keeps happening, something else is rewriting the file.

write_file: EACCES — permission denied

The user running InsightWorker doesn't have write permission. Check ls -la <path> and adjust ownership/perms.

Shell

bash: command not found

The command isn't on the InsightWorker process's PATH. Two failure modes:

  1. Different PATH per surface — VS Code's PATH might differ from your terminal's, especially on macOS. Add full paths or set PATH in ~/.insightworker/.env.
  2. Tool not installed — install via brew/apt/etc.

Long-running commands hang

The bash tool stops a command after 30 seconds by default. The agent can pass a longer timeout (in milliseconds) on a call — ask for it in your prompt, for example "run the build with a 10 minute timeout":

bash(command="...", timeout=600000)   # 10 minutes

For work that takes longer still, start it in the background and have the agent check on it, or split it into several steps.

SharePoint tools

sharepoint_list: 401 Unauthorized

Microsoft Graph token expired or app registration missing permissions. See authentication/microsoft-graph.md. For Sites.Selected apps, verify per-site grants via the PowerShell snippet in that doc.

sharepoint_read: 404 Not Found for a path that exists

InsightWorker normalizes Graph's /drive/root: prefix internally. If you're seeing 404 on a known path, two checks:

  1. The path uses backslashes (Windows-style) — Graph wants forward slashes
  2. The site URL passed to sharepoint_list doesn't match the actual site (e.g. /sites/Underwriting vs /sites/UnderwritingTeam)

Output truncated

Tool output is capped at about 10% of the active model's context window. If a listing is cut short, narrow the query or fetch the file directly with sharepoint_read.

JIRA tools

jira_search: 401 Unauthorized

Token expired or wrong basic-auth format. JIRA Cloud uses email + API token (not username + password). See authentication/jira-api-token.md.

jira_search: returns 0 results

JQL syntax error or wrong project key. Verify in the JIRA UI by running the same JQL in Issues → Advanced search.

Perplexity

perplexity_search: 401

Bad pplx- key. Regenerate at the Perplexity console.

Costs higher than expected

Each call hits sonar-pro or sonar (you control via env). For chat-style use, sonar is ~10x cheaper. Set:

PERPLEXITY_MODEL=sonar

Mermaid

mermaid_render: mmdc not found

The local mermaid CLI isn't installed. InsightWorker falls back to mermaid.ink (a public renderer). For air-gapped environments, install locally:

npm install -g @mermaid-js/mermaid-cli

mermaid.ink: invalid diagram

Your diagram has a syntax error mermaid can't parse. The error message includes the line. Common: missing semicolons, unmatched brackets, unsupported diagram type.

Provider-level errors

These look like tool failures but originate from the LLM provider:

400 max_tokens not supported, use max_completion_tokens

You're on an old InsightWorker version calling a GPT-5 family model. Upgrade to the latest CLI.

404 only supported in v1/responses

GPT-5-pro / o1-pro / *codex models need the Responses API. Upgrade to the latest CLI.

429 rate-limited

Provider tier hit. Wait, switch model, or upgrade provider plan.

When the loop detector fires

If a tool fails 3 times in a row, the agent stops. Read the first error, not the loop-detector message — that first one is the real cause. See permissions-and-safety/loop-detector.md.

See also