claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

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

Open certainmagic opened this issue 5 months ago • 7 comments

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

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

certainmagic avatar Jul 20 '25 05:07 certainmagic