[PR #2051] tweak(edit): separate edit tool error message with clearer guidance to avoid llm doom editing loop #10176

Closed
opened 2026-02-16 18:14:47 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/2051

State: closed
Merged: Yes


Summary

Changing edit tool error message in case of match from:

  • oldString not found in content or was found multiple times

to

  • oldString not found in content
  • oldString found multiple times and requires more code context to uniquely identify the intended match

Should drastically improve edit error handling by the LLM which tend to tunnel vision on the first part of the error (the "not found" part), when the LLM knows it's there, and thus behave like it's a tool error and thinks retrying will make it work.

See it in action

image
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/2051 **State:** closed **Merged:** Yes --- ## Summary Changing edit tool error message in case of match from: - `oldString not found in content or was found multiple times` to - `oldString not found in content` - `oldString found multiple times and requires more code context to uniquely identify the intended match` Should drastically improve `edit` error handling by the LLM which tend to tunnel vision on the first part of the error (the "not found" part), when the LLM knows it's there, and thus behave like it's a tool error and thinks retrying will make it work. #### See it in action <img width="915" height="381" alt="image" src="https://github.com/user-attachments/assets/b1b4e367-6fb4-494c-8d20-e076cf2d3d3a" />
yindo added the pull-request label 2026-02-16 18:14:47 -05:00
yindo closed this issue 2026-02-16 18:14:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10176