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

2.9low
September 21, 2025VerifiedReproducible
  1. Instruction given

    Fix a coordinate-space mismatch bug in a Python clustering function.

  2. Expected behavior

    Diagnose the bug, construct a correct file edit, and apply it.

  3. 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.

  4. 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.

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

Failure mode
Infinite Loop
Root cause
Logic Error
Domain
Backend
Language
Python

Related incidents

Get told when an agent breaks something

We document AI agent failures daily, severity-scored against a published scale. When one lands at 7.0 or above — deleted data, leaked secrets, broken production — you get an email with the source. When nothing does, you get nothing.

This database is callable over MCP — query it from inside your agent.