Skip to content

fix: use object schema for hooks.json to fix plugin load failure#46

Open
paikend wants to merge 1 commit intoanthropics:mainfrom
paikend:fix/hooks-json-schema
Open

fix: use object schema for hooks.json to fix plugin load failure#46
paikend wants to merge 1 commit intoanthropics:mainfrom
paikend:fix/hooks-json-schema

Conversation

@paikend
Copy link
Copy Markdown

@paikend paikend commented Mar 26, 2026

Summary

  • Four plugins shipped hooks.json as [] (empty JSON array) instead of {"hooks": {}} (empty JSON object)
  • Claude Code validates hooks config against an object schema at load time, causing all four plugins to fail with: "expected object, received array"
  • This prevented financial-analysis, equity-research, private-equity, and wealth-management plugins from loading on any OS (reported on Windows, but reproducible everywhere)

Root cause

The hooks.json files were initialized as empty arrays ([]) instead of the expected object structure. investment-banking was the only plugin with the correct format ({"hooks": {}}).

Claude Code's plugin loader runs schema validation (likely via Zod) that checks typeof data === 'object' && !Array.isArray(data). Since typeof [] === 'object' is true in JS but Array.isArray([]) is also true, the array fails the object check.

Fix

Changed 4 files from [] to {"hooks": {}}:

  • financial-analysis/hooks/hooks.json
  • equity-research/hooks/hooks.json
  • private-equity/hooks/hooks.json
  • wealth-management/hooks/hooks.json

Verification

// Simulated Claude Code validation
function validate(data) {
  if (typeof data !== 'object' || Array.isArray(data))
    throw new Error('expected object, received array');
}

validate([]);            // ❌ throws (BEFORE)
validate({"hooks": {}}); // ✅ passes (AFTER)

All 5 hooks.json files now pass object schema validation.

Test plan

  • JSON syntax validation — all files parse as valid JSON
  • Schema validation — all files are objects, not arrays
  • investment-banking (already correct) — unchanged, still passes

Fixes #11

🤖 Generated with Claude Code

Four plugins shipped hooks.json as `[]` (empty array) instead of
`{"hooks": {}}` (empty object). Claude Code validates hooks config
against an object schema, so the array causes:

  "expected object, received array"

This prevented financial-analysis, equity-research, private-equity,
and wealth-management plugins from loading. investment-banking was
already correct.

Fixes anthropics#11

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

## Bug Report: Plugins fail to load on Windows

1 participant