STUPID-2026-0137
Gemini CLI got stuck in an unbreakable edit loop, repeating "I am stuck in a loop" a dozen times without fixing the file
Why 2/10
An unbreakable edit loop; the task failed, nothing was damaged.
- Scope
- 0/4
- Time, tokens or the agent's own working state only
- Recoverability
- 0/3
- Nothing was lost
- Did it happen
- 2/2
- Happened in real use
- Beyond the user
- 0/1
- Only the user's own non-production work
The score is the sum of these four factors. How each factor is scored · scored 2026-10-29
Instruction given
Fix a coordinate-space mismatch bug in a Python clustering function.
Expected behavior
Diagnose the bug, construct a correct file edit, and apply it.
Actual behavior
Gemini CLI correctly diagnosed the coordinate-space mismatch, then entered a closed loop alternating between two near-identical lines -- "You are absolutely right. I am stuck in a loop. My apologies. I will re-read the file and then construct the correct replace command." and "Thank you. I see the exact state of the file now. I will construct the correct replace command to fix the coordinate space mismatch bug." -- roughly a dozen times in the reporter's pasted transcript, never actually applying the edit.
Damage
No data loss, but the task was never completed and the bug was never fixed. The maintainers' own triage linked #9017 as the parent of about a dozen duplicate reports of the same tool-use loop (including #9858, #9912, #10092, #10093, #5760, #5273, #7841, #7923, #8472, #8181, #8259), making this a recurring, widely-hit defect rather than a one-off. The issue sat open for over three months with no maintainer comment on root cause, then was closed "not planned" on 2025-12-28 as part of a stale-issue sweep. A comment on 2026-03-06 ("This still is an issue") reported the loop recurring on a later build months after closure.
Full write-up
A Gemini CLI user (rsanzi) reported on GitHub that the agent, while fixing a coordinate-space mismatch bug in a Python clustering function, correctly identified the problem and then fell into a closed loop: it repeated two near-identical lines — acknowledging it was "stuck in a loop," promising to re-read the file and construct the correct replace command, then simply re-stating that promise — about a dozen times without ever applying the edit. Gemini CLI's own bot-triage labeled it kind/bug and priority/p1, and other maintainer/community accounts subsequently marked roughly a dozen separate reports as duplicates of this same loop, meaning it was not an isolated occurrence. The issue drew no maintainer comment addressing the underlying cause and was closed as "not planned" on 2025-12-28 in a stale-issue sweep, with a user reporting the same behavior still present three months later.
Classification
- Agent
- Gemini CLI
- Failure mode
- Infinite Loop
- Root cause
- Logic Error
- Domain
- Backend
- Language
- Python
- MIT AI Risk Repository (our mapping)
- 7.3 Lack of capability or robustness taxonomy
- Source
- Github Issue
Related incidents
Cite this record
StupidLLM. "STUPID-2026-0137: Gemini CLI got stuck in an unbreakable edit loop, repeating "I am stuck in a loop" a dozen times without fixing the file." AI Agent Incident Database, 2026. https://www.stupidllm.com/incident/STUPID-2026-0137/ (accessed 2026-11-11). CC BY 4.0.
← STUPID-2026-0136By IDSTUPID-2026-0138 →
Get told when an agent breaks something
We document AI agent failures daily, severity-scored against a published scale. Each Monday, if any scored 7 or above that week — deleted data, leaked secrets, broken production — you get one email with the sources. When nothing did, you get nothing.
This database is callable over MCP — query it from inside your agent.