Repository navigation
Incomplete JSON when writing out files #5890
Description
Activity
github-actions commented
on Dec 21, 2025 on Dec 21, 2025 – with GitHub ActionsContributorMore actionsThis issue might be a duplicate of existing issues. Please check:
- [aws bedrock: anthropic opus 4.1] The arguments provided to the tool are invalid: Invalid input for tool write: JSON parsing failed: Text #1803: [aws bedrock: anthropic opus 4.1] The arguments provided to the tool are invalid: Invalid input for tool write: JSON parsing failed: Text - Same error with JSON parsing in write tool with incomplete closing braces
- JSON parsing failed: Text #2188: JSON parsing failed: Text - Identical error message showing truncated JSON in write tool arguments with missing closing brace
- JSON Parse error: Expected '}' with the write tool after updating to v0.5.5 Description #2002: JSON Parse error: Expected '}' with the write tool after updating to v0.5.5 - Previously reported issue with incomplete JSON causing write tool failure
All three issues report the same root cause: incomplete/truncated JSON being generated for the write tool with missing closing braces, resulting in 'JSON Parse error: Expected '}'.
Feel free to ignore if this is a new variation of the issue or if you have more specific details to add.
Same hapenning here. It often happens when I'm using superpowers:writing-plans, but solves when I say to break file on smaller ones.
This happens for me occasionally with opus 4.5 as well. A few variables in my current session that could be factors:
- A lot of subagent calls
- 48% context used
- Trying to write 500 lines
once the tool fails, it doesnt seem to be able to recover, even if I describe the missing bracket, or reboot opencode and rejoin the session and ask again
I believe this is a size issue. I didn't have it for weeks and suddenly got it today. I asked to proceed in chunks and it worked.
It's not just the size of the output, I had worked with bigger files, there must be something else at play.
What is strange is that it only does it with Opus on GH Copilot, not with Opus on Bedrock (which goes by token).
Might it be some size limitation on the GH Copilot part?Reacted by MasoudProbably Opus write bigger files. I'm my case it happens using GH copilot Sonnet
This happened to me the last couple of days also (GHCP license with Opus 4.5) when opencode was trying to create a design doc of about 110K+ in size. It also failed when I asked it to write out in chunks. However, after exiting from opencode and then resuming (opencode --c), writing out in chunks worked.
This also happened randomly when opencode was working on an implementation task and failed to create a file (same exact error message). The failure caused opencode to stop working. However, prompting it to resume usually works.Getting same issue. Error persists among different models. When outoput is too long model is not able to get correct json format.
A workarond is to direct agent to write to file in chunks.Also getting this error. It is frustrating, too, because it falls into a loop trying different solutions and burning tokens the entire time, unfairly spending my money. In my case, it complains of a missing closing brace as well.
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Description
Very often (but not always) when using Claude Opus as a model to generate files, I get an error that the file can't be created due to a JSON error:
It clearly misses the '}' at the end.
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response