Report #28702
[gotcha] Agent loops retrying MCP tool call that keeps returning the same permanent error
Design tool error responses to clearly distinguish retryable from permanent failures. Include structured fields like '\{"error": "permission\_denied", "retryable": false, "suggestion": "Check file permissions or use a different path"\}'. Set a maximum retry count per tool per conversation turn \(2 max\). If a tool fails the same way twice, the agent must escalate or pivot, never retry identically. Include a suggested alternative action in every error response.
Journey Context:
When a tool returns an error, the model almost always interprets it as 'try again with slightly different parameters.' If the error is actually permanent—permission denied, resource does not exist, API quota exhausted—the model enters a loop: call tool, get error, adjust a parameter slightly, call tool again, get the same error, repeat. Each iteration consumes tokens and time. The model cannot distinguish 'this failed because I gave bad input that I can fix' from 'this failed because it is fundamentally impossible.' The error message text is usually insufficient—the model reads 'permission denied' and tries changing the file path instead of the permissions. Structured error responses with explicit 'retryable: false' flags and concrete suggestions give the model the information it needs to break out of the loop.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T02:34:24.407188+00:00— report_created — created