Summary
The SessionStart hook in hooks/hooks.json (worker health check block) exits with code 1 without writing to stderr when the bun worker on localhost:37777 doesn't respond to /health within the 8-second retry window. Claude Code surfaces this as a confusing non-blocking error:
SessionStart:startup hook error
⎿ Failed with non-blocking status code: No stderr output
Repro
- Ensure no claude-mem worker is running (
lsof -iTCP:37777 -sTCP:LISTEN returns empty).
- Start a new Claude Code session.
- If the worker takes more than ~8s to become healthy, the hook fails silently.
Also reproducible after system sleep/reboot when the previous worker process died and the new one is slow to bind the port.
Root Cause
In hooks/hooks.json, the second and third SessionStart hooks end with:
for i in 1 2 3 4 5 6 7 8; do curl -sf http://localhost:37777/health >/dev/null 2>&1 && break; sleep 1; done; curl -sf http://localhost:37777/health >/dev/null 2>&1 || exit 1
The exit 1 bails silently — no diagnostic message, no log path, nothing. The user sees only the generic Claude Code message with no way to know which plugin or hook failed.
Suggested Fixes
- Emit a clear stderr message before exiting, e.g.:
|| { echo "claude-mem: worker on :37777 did not become healthy within 8s" >&2; exit 1; }
- Consider increasing the retry budget, or using exponential backoff, for cold-start scenarios.
- Optionally log the worker startup output to a file (
~/.claude-mem/worker.log) so users can debug without reproducing.
Environment
- macOS Darwin 25.4.0
- Claude Code (CLI)
- claude-mem plugin version 12.1.0
- Worker eventually becomes healthy; this is purely a startup race.
Workaround
Ignore the message (it's non-blocking) — subsequent sessions work fine once the worker is up.
Reported by @cags84
Summary
The
SessionStarthook inhooks/hooks.json(worker health check block) exits with code1without writing to stderr when the bun worker onlocalhost:37777doesn't respond to/healthwithin the 8-second retry window. Claude Code surfaces this as a confusing non-blocking error:Repro
lsof -iTCP:37777 -sTCP:LISTENreturns empty).Also reproducible after system sleep/reboot when the previous worker process died and the new one is slow to bind the port.
Root Cause
In
hooks/hooks.json, the second and third SessionStart hooks end with:The
exit 1bails silently — no diagnostic message, no log path, nothing. The user sees only the generic Claude Code message with no way to know which plugin or hook failed.Suggested Fixes
~/.claude-mem/worker.log) so users can debug without reproducing.Environment
Workaround
Ignore the message (it's non-blocking) — subsequent sessions work fine once the worker is up.
Reported by @cags84