Skip to content

Error Use Tool Edit #53151

Closed
Closed

Description

@Williamo2Ali

Bug Description

  1. Edit Tool Failure (Could not find oldString): When models attempt to use the edit tool, it frequently fails with the error: Could not find oldString in [file_path]. It must match exactly, including whitespace and indentation. This happens across multiple different models.
  2. OS/Shell Incompatibility: Models frequently try to execute bash or Linux-based commands/scripts (e.g., python3, npx commands configured for bash) despite the operating system environment running on Windows.

Steps to Reproduce

  1. Run OpenCode on a Windows machine.
  2. Ask the model to modify an existing file using the edit tool.
  3. Observe the oldString matching error, forcing the model to fallback to alternative shell/python workarounds.

Environment

  • OS: Windows 11
  • OpenCode Version: 2.0.22

Activity

  1. github-actions commented on Oct 4, 2026

    @github-actions
    Contributor

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

    • #52067: reports intermittent Could not find oldString failures even when the text is present.
    • #53036: reports the same edit error for indented text on v2.0.22.
    • #53149: documents edit matching failures on Windows/v2.0.22 related to line-ending handling.
    • #42733: proposes Windows shell compatibility for model-generated commands that do not match the available shell.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions