claude-code - 💡(How to fix) Fix [BUG] Windows: Bun crashes when UserPromptSubmit hook fires frequently in long sessions

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

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

Error Messages/Logs

Fix Action

Fix / Workaround

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.

Code Example

https://bun.report/1.3.14/e_1d298914mgggkEuhogCkrszYmorlU64rlXqv46vBkv06vBq6wu1Bg5p+4B6p3u1BujszYmorlU64rlXyyu4vBo9q  4vB6w95xBsznp1Bs6/jyBq9wmeq553YCYKERNEL32.DLLu10LCSntdll.dll4nhBA0eNrLzCtJTU8tUsgvSy1Ky8kvBwA2xQaD
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

  1. Configure a UserPromptSubmit hook in settings.json
  2. Run an active Claude Code session on Windows for an extended period
  3. 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

  1. Configure a UserPromptSubmit hook in settings.json (set async: true)
  2. Run an active Claude Code session on Windows for an extended period
  3. 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.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Windows: Bun crashes when UserPromptSubmit hook fires frequently in long sessions