Repository navigation
[aws bedrock: anthropic opus 4.1] The arguments provided to the tool are invalid: Invalid input for tool write: JSON parsing failed: Text #1803
Description
Activity
looks like this problem not only with write tool, but it like streaming at all for opus 4.1 in bedrock. I like stop streaming on a middle. reproduce only on large write operations. Not reproduce for opus 4. only for opus 4.1
this is likely issues on their end given the new model - give it a week and let me know if there are still problems
Reacted by Alexey Poliovfor share, I did try to use bedrock due openrouter. maybe I not completely understand how openrouter works, but in opencode, opus 4.1 on bedrock due openrouter was pretty fast and have no some steaming-like problems
@thdxr I am still facing this issue
The arguments provided to the tool are invalid: Invalid input for tool write: JSON parsing failed: Text: {"filePath": ... Error message: JSON Parse error: Expected '}'invalid [tool=write, error=Invalid input for tool write: JSON parsing failed: Text: {"filePath": "C:\Users\Project_Design_Document.md".
Error message: JSON Parse error: Expected '}']how can i fix this
This is the model calling a tool incorrectly, it should be able to recover on it's own. It called a tool with invalid json, it just has to try again generally
I get it, when the content is to long (with Copilot). Then I prompt, that it should write in chunks and then the document could be written.
Reacted by majestichouI see same issue with Opus 4.5. Switch model to Sonnet 4.5, same error.
gemini-3-pro-previewfinally went through.@thdxr don't blame the models, to me that that sounds HIGHLY brittle and a defeatist attitude . Change should have try catch and stick the response in some object. There should not be such thing as failing to parse response.
Edit: If is about the input or something complicated and you understand problem. Please describe problem better so someone smart or familiar comes up a solution. I.e, Guy who said try different model helped me a lot.⚙ invalid [tool=write, error=Invalid input for tool write: JSON parsing failed: Text: {"filePath": "/home/XXX/git- alpha/XXXX-com/src/pages/demo/page-bootstrap.vue". Error message: JSON Parse error: Expected '}'] ▣ Build · claude-opus-4.5 · 2m 9s┃
┃ go write
┃⚙ invalid [tool=write, error=Invalid input for tool write: JSON parsing failed: Text: {"filePath": "/home/XXXX/git- alpha/XXXX-com/src/pages/demo/page-bootstrap.vue". Error message: JSON Parse error: Expected '}'] ▣ Build · claude-sonnet-4.5 · 1m 49s┃
┃ go writeIt's also happened on MiniMax 2.5
invalid [tool=edit, error=Invalid input for tool edit: JSON parsing failed: Text:
Reacted by Dmitry IbragimovIt's also happened on MiniMax 2.5
invalid [tool=edit, error=Invalid input for tool edit: JSON parsing failed: Text:
approved, I have the same issue on minimax-m2.5
Similar problem in Minimax M2.7
JSON Parse error: Unexpected EOF- addedcoreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)and removed
on Mar 24, 2026 I'm getting similar problem in OpenCode 1.2.27 with minimax-m2.5. The model trys repeatedly and fails to come up with a valid edit. Sometimes it recovers on its own, but sometimes it doesn't. Sometimes it complains about 'special characters', but all of the characters it complains about are fairly normal 'special' characters that it hasn't had trouble with for the past several weeks before I started getting these errors a couple of days ago.
This time it failed with "The remaining implementation details need to be added manually due to edit tool issues." Some recovery...
Just got this with qwen3.6-35b under llama.cpp-cuda-git
- removedcoreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)
on May 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.


https://opencode.ai/s/szC8qWz4
2025-08-11T041226.log.zip