Skip to content

[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

@alexeypolitov

Activity

  1. self-assigned this
    on Aug 11, 2025
  2. alexeypolitov commented on Aug 12, 2025

    @alexeypolitov
    Author

    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

  3. thdxr commented on Aug 12, 2025

    @thdxr
    Member

    this is likely issues on their end given the new model - give it a week and let me know if there are still problems

  4. alexeypolitov commented on Aug 12, 2025

    @alexeypolitov
    Author

    for 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

  5. alexeypolitov commented on Aug 12, 2025

    @alexeypolitov
    Author

    maybe, it's related to this settings. like some limit on bedrock, that unhandled by ai-sdk

    Image
  6. ahmadomarr commented on Sep 9, 2025

    @ahmadomarr

    @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 '}'
    
  7. barrenaedu commented on Oct 8, 2025

    @barrenaedu

    Same error here, using opencode 0.14.6 and LM Studio 0.3.29 with qwen/qwen3-coder-30b. If I use qwen/qwen2.5-coder-14b the error is not present.

    Image
  8. kevinw86 commented on Dec 4, 2025

    @kevinw86

    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

  9. rekram1-node commented on Dec 4, 2025

    @rekram1-node
    Collaborator

    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

  10. nachtgold commented on Dec 16, 2025

    @nachtgold

    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.

  11. lfmunoz commented on Jan 24, 2026

    @lfmunoz

    I see same issue with Opus 4.5. Switch model to Sonnet 4.5, same error. gemini-3-pro-preview finally 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 write

  12. plutowang commented on Feb 24, 2026

    @plutowang

    It's also happened on MiniMax 2.5

    invalid [tool=edit, error=Invalid input for tool edit: JSON parsing failed: Text:

  13. diarworld commented on Feb 26, 2026

    @diarworld

    It'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

  14. gabrielhmsantos commented on Mar 24, 2026

    @gabrielhmsantos

    Similar problem in Minimax M2.7
    JSON Parse error: Unexpected EOF

  15. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    and removed on Mar 24, 2026
  16. a101010 commented on Mar 28, 2026

    @a101010

    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...

  17. sgmihai commented on Apr 18, 2026

    @sgmihai

    Just got this with qwen3.6-35b under llama.cpp-cuda-git

  18. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  19. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions