Auto-retry on [Tool result missing due to internal error]

Resolved 💬 3 comments Opened Apr 6, 2026 by Rmathis42 Closed Apr 9, 2026

Problem

During long Claude Code sessions with heavy tool usage, tool calls intermittently return [Tool result missing due to internal error] instead of the actual result. The tool call executes successfully (e.g., a file IS written to disk) but the result is lost in transit back to the model.

This causes the model to:

  1. Think the tool failed when it actually succeeded
  2. Lose momentum on multi-step tasks
  3. Require manual retry of the same command
  4. Confuse the user ("did you get stuck?")

Current behavior

When a tool result is missing, the model receives the error string and must manually decide to retry. There is no automatic retry mechanism. The user sees a pause followed by an error message and has to prompt the model to continue.

Proposed solution

Add an automatic retry mechanism for tool calls that return internal errors:

  1. Transparent retry — If a tool result comes back as [Tool result missing due to internal error], automatically retry the tool call 1-2 times before surfacing the error to the model.
  2. Idempotency awareness — For non-idempotent tools (Write, Edit), check if the operation already succeeded (e.g., file exists with expected content) before retrying.
  3. Configurable — Allow users to set retry behavior in settings.json:

``json
{
"toolRetry": {
"enabled": true,
"maxRetries": 2,
"retryableErrors": ["Tool result missing due to internal error"]
}
}
``

Context

This issue is most noticeable during:

  • Long sessions with 50+ tool calls
  • Parallel agent execution (multiple subagents using tools simultaneously)
  • Heavy Write/Bash tool usage
  • Sessions using multiple MCP servers

Environment

  • Claude Code on Windows 11 (Git Bash shell)
  • Opus 4.6 model
  • Heavy tool usage (settings.json with 100+ permission rules, 7 hooks, 11 plugins)

---

🤖 Generated with Claude Code

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗