Skip to content

fix(plugins): use canonical {"hooks": {}} for empty hooks.json#193

Open
devflowza wants to merge 1 commit into
anthropics:mainfrom
devflowza:fix/empty-hooks-json-invalid-shape
Open

fix(plugins): use canonical {"hooks": {}} for empty hooks.json#193
devflowza wants to merge 1 commit into
anthropics:mainfrom
devflowza:fix/empty-hooks-json-invalid-shape

Conversation

@devflowza
Copy link
Copy Markdown

Problem

Four vertical plugins ship hooks/hooks.json containing [] (an empty array). The Claude Code plugin loader's Zod schema expects an object at the root, so it rejects with:

Hook load failed: Invalid input: expected object, received array

Result: /doctor flags the plugin and the hooks can never be loaded.

Repro

/plugin marketplace add anthropics/financial-services
/plugin install financial-analysis
/doctor

✘ Plugin errorsfinancial-analysis [financial-analysis]: Hook load failed: [{"expected":"object","code":"invalid_type","path":[],"message":"Invalid input: expected object, received array"}]

Fix

Change []{"hooks": {}}, matching the canonical shape already used by investment-banking/hooks/hooks.json elsewhere in this repo.

Affected files (4)

  • plugins/vertical-plugins/financial-analysis/hooks/hooks.json ← actively erroring on /doctor
  • plugins/vertical-plugins/private-equity/hooks/hooks.json ← latent (same bug, just not loaded by default)
  • plugins/vertical-plugins/wealth-management/hooks/hooks.json ← latent
  • plugins/vertical-plugins/equity-research/hooks/hooks.json ← latent

Verification

Patched the locally cached marketplace copies, ran /reload-plugins + /doctor — error cleared, all four plugins load cleanly.

Test plan

  • /plugin install financial-analysis followed by /doctor shows no plugin errors
  • Same for private-equity, wealth-management, equity-research

🤖 Generated with Claude Code

Four vertical plugins ship hooks/hooks.json containing `[]`, which fails the
Claude Code plugin loader's schema (root must be an object). The loader
rejects with "expected object, received array", blocking the entire plugin
from loading.

Switch to the canonical `{"hooks": {}}` shape already used by
investment-banking/hooks/hooks.json elsewhere in this repo.

Affected plugins:
- financial-analysis (actively erroring on /doctor)
- private-equity
- wealth-management
- equity-research

Repro:
1. Install any affected plugin via /plugin marketplace add
2. Run /doctor
3. See: Hook load failed — Invalid input: expected object, received array

Verified locally by patching the cached copies and reloading plugins;
the error clears and the plugin loads cleanly.
@nmoralescyber
Copy link
Copy Markdown

Hit this locally today after installing the marketplace. [] fails Claude Code's hook schema validation with Invalid input: expected object, received array on /reload-plugins. Patched equity-research/hooks/hooks.json locally and the plugin now loads cleanly — confirms the fix.

The {"hooks":{}} shape used in this PR also matches what investment-banking/hooks/hooks.json already uses upstream, so this keeps the corpus consistent. Cleaner than #192 (which uses the same shape but expanded across multiple lines).

@nmoralescyber
Copy link
Copy Markdown

Follow-up correction to my earlier comment: when I said "loads cleanly", I'd actually patched to bare {}. That only resolves the shallower top-level schema check. Re-running /reload-plugins against {} surfaced a second error:

{
  "expected": "record",
  "code": "invalid_type",
  "path": ["hooks"],
  "message": "Invalid input: expected record, received undefined"
}

Patching to {"hooks": {}} (the exact shape in this PR) does fully resolve it. So this PR's choice isn't just cosmetic alignment with investment-banking — the hooks key is required by the validator, not just an object root.

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.

2 participants