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

Closed
opened 2026-02-16 18:07:44 -05:00 by yindo · 4 comments
Owner

Originally created by @Zwenrenmuyuan on GitHub (Jan 26, 2026).

Originally assigned to: @rekram1-node on GitHub.

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

Originally created by @Zwenrenmuyuan on GitHub (Jan 26, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description <img width="1516" height="1070" alt="Image" src="https://github.com/user-attachments/assets/8a81ea02-a38f-41f5-9861-81ea4cb2690a" /> <img width="1966" height="271" alt="Image" src="https://github.com/user-attachments/assets/de8f5e49-829a-4b88-8f82-3a64df580eca" /> 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
yindo added the windowsbug labels 2026-02-16 18:07:44 -05:00
yindo closed this issue 2026-02-16 18:07:44 -05:00
Author
Owner

@albertov commented on GitHub (Feb 3, 2026):

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 https://github.com/albertov/opencode/commit/84ce6c1861e91b2ba53537e3bab0e4a456edb23a fixes it nicely for my use case (indentation-sensitive haskell code)

@albertov commented on GitHub (Feb 3, 2026): 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 https://github.com/albertov/opencode/commit/84ce6c1861e91b2ba53537e3bab0e4a456edb23a fixes it nicely for my use case (indentation-sensitive haskell code)
Author
Owner

@albertov commented on GitHub (Feb 3, 2026):

Pushed fixed here https://github.com/anomalyco/opencode/pull/12030

@albertov commented on GitHub (Feb 3, 2026): Pushed fixed here https://github.com/anomalyco/opencode/pull/12030
Author
Owner

@Nico-Guyon commented on GitHub (Feb 8, 2026):

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 !

@Nico-Guyon commented on GitHub (Feb 8, 2026): 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 !
Author
Owner

@rekram1-node commented on GitHub (Feb 12, 2026):

This should be fixed in latest releases

I discussed w/ @albertov

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

@rekram1-node commented on GitHub (Feb 12, 2026): This should be fixed in latest releases I discussed w/ @albertov IF you still have this issue please please ping me in discord!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7616