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 hooks/hooks.json, .claude/settings.json, and .claude/settings.local.json correspond to recognized Claude Code hook events. Valid events are: PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, UserPromptSubmit, Notification, Stop, StopFailure, SubagentStart, SubagentStop, PreCompact, PostCompact, ConfigChange, SessionStart, SessionEnd, WorktreeCreate, WorktreeRemove, TeammateIdle, TaskCompleted, InstructionsLoaded, Elicitation, and ElicitationResult. 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, StopFailure, SubagentStart, SubagentStop, PreCompact, PostCompact, ConfigChange, SessionStart, SessionEnd, WorktreeCreate, WorktreeRemove, TeammateIdle, TaskCompleted, InstructionsLoaded, Elicitation, or ElicitationResult.

Options ​

This rule does not have any configuration options.

Resources ​

Version ​

Available since: v0.2.0