Line endings cause error: failed to edit, could not find the string to replace.
Describe the bug When gemini tries to edit a line, it often fails the first time with the following error:
│ ✔ Edit <path/to/file>:│
│
│ Error: Failed to edit, could not find the string to replace.
Then Gemini retries:
✦ I see, the previous replacement must have changed the line endings. I'll read the file again to make sure I have the correct content.
And this time the edit usually works.
Client information M3 Max MacBook Pro, macOS Sequoia
│ CLI Version 0.1.1
│ Git Commit 852210e1 (local modifications)
│ Model gemini-2.5-pro
│ Sandbox no sandbox
│ OS darwin
Additional context
This is a known issue with the gemini model response (and flagged as something to improve) but outside of the control of gemini-cli. Most of the time the second call to the model fixes the issue.
This is happening a lot for me. What would be helpful to know if there is anything we can do to ease this problem... Looks like a gemini self created problem? https://github.com/google-gemini/gemini-cli/issues/1971
Stuck in a forever loop.
Stuck in a forever loop.
Same here
Same here
same here
Same here
Same here
I might have found a minor fix. In case anyone here has downloaded the gemini-cli via git clone, it includes a GEMINI.md which caused those indefinite loops on my end. Now they appear once in a while, but no loops
it's a major flaw of Gemini-cli as it adds minutes to every prompt
Found possible duplicate issues:\n\n- #1028: (0.9069286584854126)\n- #2101: (0.901364803314209)\n\n
Stuck in a forever loop.