Skip to content

There is a very high probability of encountering indentation bugs when using the Edit tool in OpenCode. #10656

Closed

Description

@Zwenrenmuyuan

Description

Image Image

When OpenCode attempts to invoke the Edit tool, certain models such as GLM4.7, MiniMax M2.1, and Big Pickle (provided by OpenCode Zen) experience this issue, while others like GitHub Copilot's Haiku D4.5 work normally.

Plugins

No response

OpenCode version

OpenCode 1.1.36

Steps to reproduce

When attempting to modify an existing method with the corresponding model, there is a high probability of encountering this issue.

Screenshot and/or share link

No response

Operating System

win11

Terminal

vscode powershell

Activity

  1. albertov commented on Feb 3, 2026

    @albertov
    Contributor

    I've tracked this down to models being confused as to how to construct the replacement strings for use with the "edit" tool after seeing the context given by the "read" tool. This commit albertov@84ce6c1 fixes it nicely for my use case (indentation-sensitive haskell code)

  2. albertov commented on Feb 3, 2026

    @albertov
    Contributor

    Pushed fixed here #12030

  3. Nico-Guyon commented on Feb 8, 2026

    @Nico-Guyon

    I have the same problem tying to work with python code with opencode 1.1.53 and lot of models:

    • devstrall 2 small
    • GLM 4.7 flash
    • Qwen3-coder-next

    These indentation errors slow down a lot the agents and waste context space.
    At some point some models like q3cn write a bash or python script in order to "manually" fix the indentation.

    @albertov I tried your fix and for now I don't see indentation errors anymore !
    Thanks !

  4. rekram1-node commented on Feb 12, 2026

    @rekram1-node
    Collaborator

    This should be fixed in latest releases

    I discussed w/ @albertov

    IF you still have this issue please please ping me in discord!

  5. Neelesh2512 commented on Feb 23, 2026

    @Neelesh2512

    Hi @rekram1-node I am using latest opencode version and still facing this issue

    Image Image
  6. albertov commented on Feb 24, 2026

    @albertov
    Contributor

    I'm also seeing issues, seems model dependent, t's Sonnet 4.6 in this case. I will try to fix again when I get a chance

    Image
  7. contentnation commented on Apr 12, 2026

    @contentnation

    I also face this issue with glm 4.7-flash and qwen3-coder-next they keeps messing up indents. almost unusable, need 4 or 5 round to fix the indents, sometimes editing the files manually to get it fixed. this ruins the usefulness of opencode. running version 1.4.3. I can't ping anyone on discord, not 1 million horses could drag me there! @rekram1-node hope this gets to you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwindows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions