SessionStart HTTP hooks silently fail (other "command only" events work fine)
Environment
- Claude Code version: 2.1.63
- OS: macOS (Darwin 23.5.0, arm64)
- Shell: bash
Description
HTTP hooks (type: "http") configured for SessionStart never fire. The HTTP request never reaches the server. All other hook events — including ones the docs also list as "command only" like SessionEnd, Notification, and SubagentStart — work correctly with HTTP hooks.
Steps to reproduce
- Run a local HTTP server on port 3333 with request logging enabled
- Configure
SessionStartas an HTTP hook in~/.claude/settings.json:
``json``
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "http",
"url": "http://localhost:3333/hook"
}
]
}
],
"SessionEnd": [
{
"hooks": [
{
"type": "http",
"url": "http://localhost:3333/hook"
}
]
}
]
}
}
- Start a new Claude Code session
- Exit the session
Expected behavior
Both SessionStart and SessionEnd HTTP requests arrive at the server.
Actual behavior
SessionEndarrives correctly:POST /hookwithhook_event_name: "SessionEnd"SessionStartnever arrives — no request at all
The hook is loaded (confirmed via /hooks menu). The server is running (confirmed by other events arriving). The request simply never gets sent.
Workaround
Using a type: "command" hook with curl works:
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "curl -s -X POST http://localhost:3333/hook -H 'Content-Type: application/json' -d '{\"hook_event_name\":\"SessionStart\"}'"
}
]
}
]
}
}
Likely cause
The CHANGELOG for v2.1.48 mentions:
"Improved startup performance by deferring SessionStart hook execution, reducing time-to-interactive by ~500ms."
The deferred execution path likely doesn't dispatch HTTP hooks, only command hooks.
Note on docs vs behavior
The hooks reference lists SessionStart under "Events that only support type: command hooks." However, other events on that same list (SessionEnd, Notification, SubagentStart, SubagentStop, PreCompact) do work with HTTP hooks. SessionStart is the only one that actually enforces the restriction. See related issue for the docs inconsistency.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗