void icon indicating copy to clipboard operation
void copied to clipboard

[Bug]: agent keeps failing when trying to edit files, it says it cannot find the search anchor screen for the replacement

Open mansyno opened this issue 8 months ago • 7 comments

  1. VSCode Version: 1.99.30034 (system setup) Void Version: 1.3.10 Commit: 906502f6600146442d41bc314c2dd011c686941f Date: 2025-05-16T20:35:23.913Z Electron: 34.3.2 ElectronBuildId: undefined Chromium: 132.0.6834.210 Node.js: 20.18.3 V8: 13.2.152.41-electron.0 OS: Windows_NT x64 10.0.19045

  2. Describe the issue/feature here! the agent reads an exisiting file (py) and said they going to make changes but they fail repeatedly with a mismatch error: below is the text of the error msg

i am using gemini-2.5-flash-preview-04-17

one the time the agent replied that it has hard time with the "edit_file" tool and that the agent will try using another tool called "rewrite_file" or similar

here is the error msg: Error: Error: The edit was not applied. The text in ORIGINAL must EXACTLY match lines of code in the file, but there was no match for: "\n if current_app_state == AppState.SETTINGS:\n settings_screen.handle_input(event)\n if settings_screen.is_game_start_requested():\n # Transition to game state\n========\n\n if current_app_state == AppState.SETTINGS:\n settings_screen.handle_input(event)\n # Add call to update the settings screen, necessary for GUI libraries like pygame_gui\n settings_screen.update(clock.get_time() / 1000.0)\n if settings_screen.is_game_start_requested():\n # Transition to game state\n>>>>>>> UPDATED". Ensure you have the latest version of the file, and ensure the ORIGINAL code matches a code excerpt exactly.

this is what the agent said on one of those failures:

It seems the edit failed again. I apologize for the repeated issues with modifying main.py. The tool requires an exact match for the ORIGINAL block, and even subtle differences in whitespace or comments can cause it to fail.

mansyno avatar May 17 '25 14:05 mansyno

It seems gemini-2.5-flash isn't great at outputting Search/Replace blocks. Not sure what we can do other than just ask it to rewrite files instead, but that's not a great solution either and is probably not desired in a lot of cases.

Will keep this open for now, if anyone has any suggestions feel free to discuss.

andrewpareles avatar May 23 '25 07:05 andrewpareles

This is an issue with every model I have tested, nothing works in Void to edit files, it just errors out and says file doesn't exist" after a read_file call.

Are there specific requirements to have a model actually work? Specific tool capabilities etc? What model that can be run locally works?

Because my attempts to look into this today for my team have just made me think that void just doesn't work at all.

duaneking avatar Jun 09 '25 23:06 duaneking

I also noticed this problem when using 2.5 flash. Not sure about the other models, looking for any solve or solution for this.

Jian-blue avatar Jul 05 '25 12:07 Jian-blue

same. every single model i've used (10-15) is unable to edit or save files in void's agent mode.

ColinRitman avatar Jul 26 '25 15:07 ColinRitman

Same here with every single model.

MagicJinn avatar Aug 22 '25 16:08 MagicJinn

Im also having this issue randomly. it goes in and out.

trekfan42 avatar Aug 25 '25 02:08 trekfan42