Skip to content

Fix hooks.json schema: nest matcher commands under "hooks" array#3

Open
takekaraka wants to merge 1 commit into
DojoCodingLabs:mainfrom
takekaraka:fix/hooks-schema-nested-array
Open

Fix hooks.json schema: nest matcher commands under "hooks" array#3
takekaraka wants to merge 1 commit into
DojoCodingLabs:mainfrom
takekaraka:fix/hooks-schema-nested-array

Conversation

@takekaraka

Copy link
Copy Markdown

Fixes #2.

Problem

Claude Code /doctor reports a hook load failure and none of the plugin hooks load:

Hook load failed: expected array, received undefined
  path: ["hooks","PreToolUse",0,"hooks"]
  path: ["hooks","PreToolUse",1,"hooks"]
  path: ["hooks","PostToolUse",0,"hooks"]
  path: ["hooks","PostToolUse",1,"hooks"]

Each matcher entry in hooks/hooks.json placed type/command/timeout directly on the matcher object. The Claude Code hooks schema requires those nested inside a per-matcher hooks array.

Fix

Wraps all four matcher entries (2 PreToolUse, 2 PostToolUse) in the required hooks array. JSON validated. No behavior change beyond the hooks now actually loading.

Before:

{ "matcher": "...", "type": "command", "command": "...", "timeout": 5000 }

After:

{ "matcher": "...", "hooks": [ { "type": "command", "command": "...", "timeout": 5000 } ] }

Each PreToolUse/PostToolUse matcher entry placed type/command/timeout
directly on the matcher object. The Claude Code hooks schema requires
those nested inside a per-matcher "hooks" array, so validation failed
with "expected array, received undefined" and none of the plugin hooks
loaded.

Wraps all four matcher entries (2 PreToolUse, 2 PostToolUse) in the
required "hooks" array. No behavior change beyond the hooks now loading.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@dojo-code-reviewer dojo-code-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved

Approved — no findings. Confidence: 5/5.

@andrekovac

Copy link
Copy Markdown

+1 please merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hooks/hooks.json fails schema validation: matcher entries missing nested "hooks" array

2 participants