Plugin loader crashes on hooks.json with [] or {} (missing hooks key)

Resolved 💬 3 comments Opened Mar 7, 2026 by richiestanaway Closed Apr 30, 2026

Bug

The plugin loader fails to load plugins when hooks/hooks.json contains [] or {} instead of {"hooks": {}}.

Error:

Failed to load hooks from .../hooks/hooks.json: [
  {
    "expected": "record",
    "code": "invalid_type",
    "path": ["hooks"],
    "message": "Invalid input: expected record, received undefined"
  }
]

Reproduction

Any plugin with hooks/hooks.json containing [] or {} will fail to load. This currently affects 4 plugins in anthropics/financial-services-plugins: equity-research, financial-analysis, private-equity, wealth-management.

Expected behavior

The loader should gracefully handle plugins that don't define hooks. [], {}, or a missing hooks key should all be treated as "no hooks" rather than a validation error.

Workaround

Change hooks/hooks.json to {"hooks": {}} — but this is fragile since plugin updates can overwrite it.

Environment

  • Claude Code 2.1.71
  • macOS Darwin 24.6.0

🤖 Generated with Claude Code

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗