Skip to content

[Bug][P1] Invalid hook type 'StopFailure' causes Claude Code settings error on session creation #555

@lorenzostorchi

Description

@lorenzostorchi

Description

When creating a session, Aegis generates a hooks file with StopFailure as a hook type, which Claude Code does not recognize. This causes Claude Code to fail with a settings error and prevents the session from starting properly.

Error

Settings Error
/tmp/aegis-hooks/hooks-493c7850-b383-4a4e-9a57-69b7fcc70825.json
 └ hooks
   └ StopFailure: Invalid key in record

Environment

  • Aegis version: 2.2.2 (via npx aegis-bridge)
  • Claude Code version: 2.1.63
  • OS: Raspberry Pi OS (Debian 12) on arm64
  • Node: v22.19.0

Steps to Reproduce

  1. Run npx aegis-bridge
  2. Create a session:
curl -X POST http://127.0.0.1:9100/v1/sessions   -H "Content-Type: application/json"   -d '{"name": "test-session", "workDir": "/home/openclaw/.openclaw/workspace", "prompt": "Create a hello.txt file"}'
  1. Check the pane output - Claude Code shows the settings error

Generated Hooks File

{
  "hooks": {
    "StopFailure": [
      {
        "hooks": [
          {
            "type": "http",
            "url": "http://127.0.0.1:9100/v1/hooks/StopFailure?sessionId=..."
          }
        ]
      }
    ],
    ...
  }
}

Suggested Fix

Remove or rename StopFailure to a valid Claude Code hook type. Check the Claude Code documentation for the list of supported hook types.

Additional Notes

Other hook types in the generated file may also be invalid - worth validating the full list against Claude Code's supported hooks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:hooksRelated to hooks systembugSomething isn't workingpriority:P2Medium priority

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions