TypeError in settings validation: Cannot assign to read only property '0' of object '[object String]'

Status Closed — not planned
Maintainer reply None cached
Activity 10 comments · opened Jul 20, 2025 · closed Jan 20, 2026

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

View original on GitHub ↗

10 Comments

Nschumi · 1 year ago

I am also getting this. And due to that, i cant use hooks ( as far as ive tested )

certainmagic · 1 year ago

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 run claude /doctor:

{
  "hooks": {
    "tool-use-submit": [
      {
        "command": "exit 1"
      }
    ]
  }
}

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

github-actions[bot] · 1 year ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/5560
  2. https://github.com/anthropics/claude-code/issues/5886

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

certainmagic · 1 year ago

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.

dimsav · 1 year ago

I'm experiencing the exact same issue with Claude Code on macOS. The /doctor command fails with the same error when I have hooks with args arrays
in 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
}
]
}
}


Temporarily removing the hooks allows /doctor to run successfully. The hooks themselves work fine during normal operation - it's only the doctor  validation that breaks.
github-actions[bot] · 10 months ago

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.

timurmr · 10 months ago

Still have this issue with Claude Code v2.0.73

github-actions[bot] · 8 months ago

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.

marcindulak · 8 months ago

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.

github-actions[bot] · 8 months ago

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.