[BUG] Bare hook entry {type, command} silently breaks entire hooks config — no error, no warning
Resolved 💬 4 comments Opened Apr 17, 2026 by adelaidasofia Closed May 27, 2026
Summary
If a hook entry in settings.json uses the flat {type, command} format instead of the required {matcher, hooks: [{type, command}]} wrapper, the entire hooks configuration silently fails. No error is reported, no invalid-format warning is shown, and all hooks in the file stop working — not just the malformed entry.
Steps to reproduce
- Add a hook to
~/.claude/settings.jsonin the flat format:
{
"hooks": {
"PreToolUse": [
{
"type": "command",
"command": "echo hello"
}
]
}
}
- Run Claude Code and trigger the event.
- The hook does not fire. No error is reported.
- Other hooks in the same file also stop firing.
Expected behavior
One of:
- Accept the flat format as a shorthand, OR
- Log a clear startup error:
Hook at hooks.PreToolUse[0] is missing required matcher and hooks wrapper
Silent failure that takes down all hooks is the worst outcome. The correct format is not obvious from context and the failure mode gives no signal.
Correct format
{
"hooks": {
"PreToolUse": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "echo hello"
}
]
}
]
}
}
Environment
- macOS Darwin 25.4.0
- Claude Code: latest CLI
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗