Model is confused by tool errors #1997

Closed
opened 2026-02-16 17:33:40 -05:00 by yindo · 2 comments
Owner

Originally created by @agladysh on GitHub (Oct 8, 2025).

Originally assigned to: @rekram1-node on GitHub.

One of examples, where model does not understand from the error message that it needs to do, resorts to sed and breaks the code:

Edit packages/minimal-cli/src/batch-mode.ts

Error: oldString found multiple times and requires more code context to uniquely identify the intended match

Edit packages/minimal-cli/src/batch-mode.ts

Error: oldString found multiple times and requires more code context to uniquely identify the intended match

Grep packages/minimal-cli/src/batch-mode.ts (pattern=path.dirname\(reviewDirectory\))

Found 2 matches
packages/minimal-cli/src/batch-mode.ts:
  Line 224:         const actionPath = path.join(path.dirname(reviewDirectory), 'actions', 'review-common.yaml');
  Line 379:         const actionPath = path.join(path.dirname(reviewDirectory), 'actions', 'review-common.yaml');

Edit packages/minimal-cli/src/batch-mode.ts

Error: oldString found multiple times and requires more code context to uniquely identify the intended match

Shell Remove the actionPath calculation

$ cd packages/minimal-cli/src && sed -i '' 's|const actionPath = path\.join(path\.dirname(reviewDirectory), '\''actions/review-common\.yaml'\'');|// Action path resolved by ReviewDirectory|g' batch-mode.
ts

This is a common enough pattern for current tool errors.

Another common issues is model ignoring non-zero exit codes of a bash tool command it runs

If the error messages are well visible to the model and clearly indicated as errors in the current implementation, please consider enriching the error texts with clear actionable guidance of what model needs to do. E.g. instead of "oldString found multiple times and requires more code context to uniquely identify the intended match" say "oldString found multiple times. Include more code context to uniquely identify the intended match"

Originally created by @agladysh on GitHub (Oct 8, 2025). Originally assigned to: @rekram1-node on GitHub. One of examples, where model does not understand from the error message that it needs to do, resorts to `sed` and breaks the code: ``` Edit packages/minimal-cli/src/batch-mode.ts Error: oldString found multiple times and requires more code context to uniquely identify the intended match Edit packages/minimal-cli/src/batch-mode.ts Error: oldString found multiple times and requires more code context to uniquely identify the intended match Grep packages/minimal-cli/src/batch-mode.ts (pattern=path.dirname\(reviewDirectory\)) Found 2 matches packages/minimal-cli/src/batch-mode.ts: Line 224: const actionPath = path.join(path.dirname(reviewDirectory), 'actions', 'review-common.yaml'); Line 379: const actionPath = path.join(path.dirname(reviewDirectory), 'actions', 'review-common.yaml'); Edit packages/minimal-cli/src/batch-mode.ts Error: oldString found multiple times and requires more code context to uniquely identify the intended match Shell Remove the actionPath calculation $ cd packages/minimal-cli/src && sed -i '' 's|const actionPath = path\.join(path\.dirname(reviewDirectory), '\''actions/review-common\.yaml'\'');|// Action path resolved by ReviewDirectory|g' batch-mode. ts ``` This is a common enough pattern for current tool errors. Another common issues is model ignoring non-zero exit codes of a bash tool command it runs If the error messages are well visible to the model and clearly indicated as errors in the current implementation, please consider enriching the error texts with clear actionable guidance of what model needs to do. E.g. instead of "oldString found multiple times and requires more code context to uniquely identify the intended match" say "oldString found multiple times. Include more code context to uniquely identify the intended match"
yindo closed this issue 2026-02-16 17:33:40 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 8, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #2996: Model tends to misuse Grep tool - Similar pattern of model not understanding tool error messages and using wrong approaches
  • #2985: Bash tool does not show time out to model or user, model might set time out incorrectly - Related issue about models ignoring non-zero exit codes and tool feedback
  • #2882: bug: parallel edit tool calls on same file will error out - Shows similar pattern of confusing error messages that could benefit from more actionable guidance
  • #2904: Icons/Unicode characters cause file editing failures - Contains examples of models resorting to sed when edit tool fails, very similar to the sed usage pattern described in #3030

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 8, 2025): This issue might be a duplicate of existing issues. Please check: - #2996: Model tends to misuse Grep tool - Similar pattern of model not understanding tool error messages and using wrong approaches - #2985: Bash tool does not show time out to model or user, model might set time out incorrectly - Related issue about models ignoring non-zero exit codes and tool feedback - #2882: bug: parallel edit tool calls on same file will error out - Shows similar pattern of confusing error messages that could benefit from more actionable guidance - #2904: Icons/Unicode characters cause file editing failures - Contains examples of models resorting to sed when edit tool fails, very similar to the sed usage pattern described in #3030 Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 8, 2025):

yeah agree

@rekram1-node commented on GitHub (Oct 8, 2025): yeah agree
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1997