You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue might be a duplicate of existing issues. Please check:
Tool.edit should recieve json object #6838: Tool.edit should receive json object - Similar issue where LLM passes JSON objects instead of strings to edit tool parameters
The root cause appears to be that some LLM models (like Qwen3-coder) pass JSON objects for oldString and newString when they should pass strings. This is similar to the broader issue documented in #6838 where models struggle with properly stringifying JSON content for the edit tool.
Feel free to ignore if your specific case differs from these existing issues.
Same here. Qwen is hard to use with opencode and always made problems. AFAIK: the problem is not opencode in particular but also qwen3 misunderstanding the tools/capabilities provided by opencode. I heard of proxies acting as "man in the middle" fixing tool calling for qwen3.
Edit: Please notice that those proxies only have been tested with Qwen3-Coder-30B-A3B-Instruct. Other Qwen3 variations may have different problems. I had no luck the versions provided by ollama
Very similar problem with Qwen3-Coder-Next. I receive this consistently when it tries to call the write tool:
The write tool was called with invalid arguments: [ { "expected": "string", "code": "invalid_type", "path": [ "filePath" ], "message": "Invalid input: expected string, received undefined" } ]. Please rewrite the input so it satisfies the expected schema.
I receive this error a fair bit. Eventually it figures out to use a different method, or I cancel and tell it to use a different method.
Reacted by Miha Jakovac, Perry Mitchell, Peter McHale and Bahaa Tuffaha
After using opencode for some time now, write issues happens mostly when context window reaches above 50-70% of model's configured context window limit. Thinking if its the model's attention span or just hallucinations that cause looping when invoking tools
Is this the same issue? I'm using Qwen3-coder 480B in OpenCode 1.4.0
→ Read build.sh [limit=5, offset=56]
Now I'll make the correct edit with the exact content:
← Edit build.sh
Could not find oldString in the file. It must match exactly, including whitespace, indentation, and line endings.
Activity
github-actions commentedon Jan 5, 2026
This issue might be a duplicate of existing issues. Please check:
The root cause appears to be that some LLM models (like Qwen3-coder) pass JSON objects for
oldStringandnewStringwhen they should pass strings. This is similar to the broader issue documented in #6838 where models struggle with properly stringifying JSON content for the edit tool.Feel free to ignore if your specific case differs from these existing issues.
PhantomKnight287 commentedon Jan 6, 2026
Facing same on Macos 15.6.1 and Ghostty
arne-fuchs commentedon Jan 20, 2026
Same here. Qwen is hard to use with opencode and always made problems. AFAIK: the problem is not opencode in particular but also qwen3 misunderstanding the tools/capabilities provided by opencode. I heard of proxies acting as "man in the middle" fixing tool calling for qwen3.
Edit: Please notice that those proxies only have been tested with Qwen3-Coder-30B-A3B-Instruct. Other Qwen3 variations may have different problems. I had no luck the versions provided by ollama
GiveMe-A-Name commentedon Jan 28, 2026
Same problems with GLM4.7
nabil86 commentedon Feb 4, 2026
I have same issue with GLM 4.7-flash & qwen3-coder .
i'm using ollama (localy)
GiveMe-A-Name commentedon Feb 5, 2026
Every time I want read or write files using ai. I will occur error.
And this issues don't solved in opencode@1.1.15
It's so sad
giraudremi92 commentedon Feb 5, 2026
same on qwen 3 coder next 80b
sometimes its go on with cat
Switch orchestrator to Coder model and consolidate P0/P1 fixes
itsShnik commentedon Feb 10, 2026
Same problem with gemini-3-pro-preview high (variant)
CVeRiTy commentedon Feb 13, 2026
Very similar problem with Qwen3-Coder-Next. I receive this consistently when it tries to call the write tool:
The write tool was called with invalid arguments: [ { "expected": "string", "code": "invalid_type", "path": [ "filePath" ], "message": "Invalid input: expected string, received undefined" } ]. Please rewrite the input so it satisfies the expected schema.
I receive this error a fair bit. Eventually it figures out to use a different method, or I cancel and tell it to use a different method.
mihaj commentedon Feb 13, 2026
I get this quite a but with Qwen3-Coder-Next. not sure if it has anything to do with this long token generation steps (more than 1500 fore example).
I am using LM Studio 0.4.2 (Build 2), OpenCode 1.1.62 and Llama 2.2.0 runtime in LM Studio. Model is from Qwen3-Coder-Next Unsloth MXFP4.
gtrak commentedon Feb 13, 2026
There's some upstream bugs:
ggml-org/llama.cpp#19430 hard crash
ggml-org/llama.cpp#19382 broken filePath json
Is there any known workaround?
25 remaining items
Rudd-O commentedon Mar 12, 2026
I was gonna try GLM 4.7 but now I've read it has the same problem.
This problem slows down the agent substantially and wastes context.
FN-FAL113 commentedon Mar 13, 2026
After using opencode for some time now, write issues happens mostly when context window reaches above 50-70% of model's configured context window limit. Thinking if its the model's attention span or just hallucinations that cause looping when invoking tools
mlazzarotto commentedon Apr 8, 2026
Is this the same issue? I'm using Qwen3-coder 480B in OpenCode 1.4.0
bhuv-z commentedon Apr 9, 2026
Facing a similar issue. Qwen Coder Next hosted through LM Studio:

Processes promt for several minutes, only for tool call to fail
fix(tool): coerce object args to string in edit and write tools
bhuv-z commentedon Apr 12, 2026
Can someone take a look at the PR's and approve one of them, there seem to be 3 addressing this, with one all green.
peterdenham commentedon Apr 19, 2026
I am no longer able to reproduce this issue with Qwen3.5 . Maybe it was fixed in a recent
opencoderelease?ariel-udc commentedon Apr 19, 2026
I just got the same error using Qwen 3.6 plus:
peterdenham commentedon Apr 19, 2026
@ariel-udc can you retry with the latest opencode version -
1.14.18? Qwen 3.5 & 3.6 were able to write json objects to files here.bhuv-z commentedon Apr 21, 2026
@peterdenham Problem still occurs on latest opencode with qwen3.6-35b-a3b
Native file-io tool calls work seamless on Claude Code. Issue seems to be only in opencode.
the-webguys commentedon Apr 22, 2026
I just published a tool to bridge this issue and hopefully more:
https://github.com/the-webguys/llama-BridgeAI
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.