TypeError in settings validation: Cannot assign to read only property '0' of object '[object String]'
## Bug Description
Claude Code throws a TypeError when validating settings.json with hook configuration.
## Error Output
TypeError: Cannot assign to read only property '0' of object '[object String]'
at KOB (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:609:6891)
at UOB (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:609:7092)
at YyB (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:609:31595)
at LyB (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:609:32717)
at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1806:87
at Array.forEach ()
at Sl6 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1806:38)
at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1806:593
at Array.map ()
at iJB (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1806:444)
## Settings Configuration
```json
{
"hooks": {
"tool-use-submit": [
{
"command": "if [[ \"$CLAUDE_TOOL_NAME\" == \"Bash\" && (\"$CLAUDE_COMMAND\" == \"mvn test\" || \"$CLAUDE_COMMAND\" == \"mvn clean test\") ]]; then exit 0; else exit 1; fi",
"description": "Auto-approve Maven test commands"
}
]
}
}
## Steps to Reproduce
1. Create ~/.claude/settings.json with the above content
2. Run claude /doctor
3. Error occurs during settings validation
Environment
- OS: macOS (Darwin 24.5.0)
- claude --version: 1.0.56 (Claude Code)
---
Claude wrote almost all of this bug report after i fed it the output of "claude /doctor". I fixed the formatting a tiny bit & I added the claude version number at the end. Please let me know if you need something else.
10 Comments
I am also getting this. And due to that, i cant use hooks ( as far as ive tested )
fwiw, Claude wrote that version of the settings file for me.
here's an even simpler ~/.claude/settings.json that also causes
TypeError: Cannot assign to read only property '0' of object '[object String]'when I runclaude /doctor:(and, as i'm reading the actual docs, i'm not convinced these are valid. i would still hope they wouldn't crash and hang /doctor, but it could be at least partial pilot error.)
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
The second of those seems like a much better bug report than mine and it is likely that a fix for it would fix the issue I saw. I'm not in a position to validate that it did, but I'm comfortable with this being closed.
I'm experiencing the exact same issue with Claude Code on macOS. The
/doctorcommand fails with the same error when I have hooks withargsarraysin my
.claude/settings.json:```json
{
"hooks": {
"post_file_update": [
{
"name": "format_php_with_pint",
"condition": {
"file_extension": ".php"
},
"command": "vendor/bin/pint",
"args": ["${file_path}"],
"working_directory": "${project_root}",
"timeout": 30
}
]
}
}
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Still have this issue with Claude Code v2.0.73
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.