[Bug]: agent keeps failing when trying to edit files, it says it cannot find the search anchor screen for the replacement
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
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.
Source: voideditor/void