Report #16784
[gotcha] Agent stuck in infinite retry loop calling same MCP tool with same arguments after error
Implement a hard retry limit \(max 2-3 attempts per tool\+args combination\); return structured errors that include a suggested fix or alternative approach; track the tool-call history in the session and detect when the agent is repeating itself; inject a system message after 2 identical failures forcing a strategy change.
Journey Context:
When a tool returns an error \(rate limit, permission denied, transient failure\), the model often retries with identical parameters, hoping for a different result. This is especially common with non-deterministic failures. Each retry consumes context window and tokens, and the accumulating failed attempts further degrade the model's ability to reason about alternatives. The fix isn't just a retry counter—it's making the error message actionable. 'Permission denied' → 'Permission denied. Try list\_accessible\_paths first to find resources you can read.' This gives the model a new path forward instead of a dead end.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:42:43.591856+00:00— report_created — created