[BUG] Windows: Bun crashes when UserPromptSubmit hook fires frequently in long sessions
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Body:
Environment
- OS: Windows 11 Pro
- Claude Code version: (fill in)
- Hook type: UserPromptSubmit
What happened
Claude Code (which bundles Bun on Windows) crashes during active sessions when a UserPromptSubmit hook fires
repeatedly. The crash appears to be triggered by the hook process rather than the main Claude Code process.
Crash report
https://bun.report/1.3.14/e_1d298914mgggkEuhogCkrszYmorlU64rlXqv46vBkv06vBq6wu1Bg5p+4B6p3u1BujszYmorlU64rlXyyu4vBo9q
4vB6w95xBsznp1Bs6/jyBq9wmeq553YCYKERNEL32.DLLu10LCSntdll.dll4nhBA0eNrLzCtJTU8tUsgvSy1Ky8kvBwA2xQaD
Workaround
Rewriting the hook to use async: true in settings.json and routing through the app's own HTTP API (instead of direct
DB connections or WebSocket operations) reduced but did not eliminate the crashes.
Steps to reproduce
- Configure a UserPromptSubmit hook in settings.json
- Run an active Claude Code session on Windows for an extended period
- Observe crash on hook invocation
Expected behavior
Hook fires without crashing the Claude Code process.
What Should Happen?
The UserPromptSubmit hook should fire asynchronously without affecting the main Claude Code process. Since it's
configured with async: true, the hook process lifecycle should be fully isolated — a failure or exception in the
hook (network timeout, fetch error, process exit) should never propagate back to crash the parent Claude Code
session.
Error Messages/Logs
https://bun.report/1.3.14/e_1d298914mgggkEuhogCkrszYmorlU64rlXqv46vBkv06vBq6wu1Bg5p+4B6p3u1BujszYmorlU64rlXyyu4vBo9q 4vB6w95xBsznp1Bs6/jyBq9wmeq553YCYKERNEL32.DLLu10LCSntdll.dll4nhBA0eNrLzCtJTU8tUsgvSy1Ky8kvBwA2xQaD
Steps to Reproduce
- Configure a UserPromptSubmit hook in settings.json (set async: true)
- Run an active Claude Code session on Windows for an extended period
- Send several prompts — Claude Code crashes on hook invocation
Claude Model
Sonnet (default)
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.143
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
this is worth including: the hook originally made a direct DB fetch (Neon HTTP API); rewriting it
to call the local app's HTTP API (localhost:3000) with async: true reduced frequency but the crash recurred. That
tells them the crash isn't specific to the hook's network target.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗