Skip to content

hooks-invalid-event

Hook events must be valid event names

Warning

Rule Details

This rule validates that the keys in the hooks object of settings.json correspond to recognized Claude Code hook events. Valid events are: PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, UserPromptSubmit, Notification, Stop, SubagentStart, SubagentStop, PreCompact, SessionStart, SessionEnd, TeammateIdle, and TaskCompleted. An unrecognized event name means the hook will never fire, silently failing to provide the intended automation.

Incorrect

Hook using a misspelled event name

json
{
  "hooks": {
    "BeforeToolUse": [
      { "matcher": "*", "hooks": [{ "type": "command", "command": "./lint.sh" }] }
    ]
  }
}

Correct

Hook using a valid event name

json
{
  "hooks": {
    "PreToolUse": [
      { "matcher": "*", "hooks": [{ "type": "command", "command": "./lint.sh" }] }
    ]
  }
}

How To Fix

Replace the invalid event name with one of the recognized hook events: PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, UserPromptSubmit, Notification, Stop, SubagentStart, SubagentStop, PreCompact, SessionStart, SessionEnd, TeammateIdle, or TaskCompleted.

Options

This rule does not have any configuration options.

Resources

Version

Available since: v0.2.0