Skip to content

JSON Parse error: Expected '}' with the write tool after updating to v0.5.5 Description #2002

Closed

Description

@behavio1

Since updating to OpenCode version 0.5.5, I am encountering a persistent error when the agent attempts to use the write tool. The operation consistently fails with a JSON parsing error.

Error message:

Write

The arguments provided to the tool are invalid: Invalid input for tool write: JSON parsing
failed: Text: {"filePath":
"/Users/M***/*****.md".
Error message: JSON Parse error: Expected '}'

As shown the filePath string being passed to the write tool appears to be truncated. This results in an incomplete and malformed JSON object, which lacks the closing double quote for the file path and the final closing curly brace }. This malformed JSON is causing the JSON Parse error.
This issue seems to be a regression introduced in version 0.5.5, as this functionality was working correctly in previous versions. This bug is critical as it prevents the agent from creating or modifying files.

Steps to Reproduce

  • Update to OpenCode version 0.5.5.
  • Assign a task that requires the agent to write to a file with a relatively long file path.
  • Observe the write tool failing with the "JSON Parse error: Expected '}'" message.

Expected Behavior
The write tool should receive a complete and valid JSON object, allowing it to successfully write to the specified file.

Activity

  1. github-actions commented on Aug 16, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. thdxr commented on Aug 17, 2025

    @thdxr
    Member

    what model is this?

  3. behavio1 commented on Aug 18, 2025

    @behavio1
    Author

    Claude Sonnet 4. I restarted my computer and now it works better - this issue is not appearing anymore so far.

  4. jayair commented on Aug 19, 2025

    @jayair
    Contributor

    Closing this then

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