[BUG] Write tool fails with "object instead of string" error when writing files
Environment
- Platform: darwin (macOS)
- Claude CLI version: 1.0.94
- Operating System: e.g. macOS 15.6
- Terminal: Apple Terminal
- Model: Claude Sonnet 4 (claude-sonnet-4-20250514)
- Feedback ID: 92e30ddf-0a7b-45e1-a630-e620c6b26e99
Bug Description
File writes consistently fail on project initialization:
<img width="971" height="678" alt="Image" src="https://github.com/user-attachments/assets/83253eed-66c2-4247-9dba-3e619cb2e700" />
Specifically (as generated by Claude):
- The Write tool consistently fails with InputValidationError: The parameter 'content' type is
expected as string but provided as object when attempting to write JSON content to files
- This occurs even when the JSON is properly formatted as a string
- Simple text files write successfully, indicating the issue is specific to JSON content
parsing
- The error suggests the tool parameter parser is incorrectly interpreting JSON strings as
objects
Steps to Reproduce
- Use Write tool to create a JSON file (e.g., manifest.json for Chrome extension or Node app)
- Provide properly formatted JSON as string content
- Tool fails with type validation error
Expected Behavior
<!-- What you expected to happen -->
Files are written successfully
Actual Behavior
<!-- What actually happened -->
Consistent Error writing file, Claude ended up falling back to use bash scripts to echo and pipe directly into each file.
Additional Context
<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->
<img width="978" height="628" alt="Image" src="https://github.com/user-attachments/assets/30cc4c2b-5d85-4d57-bea6-66a82b14e000" />
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗