claude-code - 💡(How to fix) Fix AbortError in hook callback wedges query mid-stream; stdout silent, no result, no recovery [1 pull requests]

Official PRs (…)
ON THIS PAGE

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…

When the CLI runs as a subprocess (observed via Claude Desktop's local-agent / Cowork mode on Linux, but the failure is inside the CLI itself), a turn stalls mid-stream after a tool use. The process keeps running but emits no further stdout — no more tokens and no final result message. The parent harness is left with a live session that never completes and cannot be aborted gracefully.

Error Message

AbortError: at A (/$bunfs/root/src/entrypoints/cli.js:9486:473) at z (/$bunfs/root/src/entrypoints/cli.js:2881:186) Error in hook callback hook_1: AbortError: at A (/$bunfs/root/src/entrypoints/cli.js:9486:473)

Root Cause

When the CLI runs as a subprocess (observed via Claude Desktop's local-agent / Cowork mode on Linux, but the failure is inside the CLI itself), a turn stalls mid-stream after a tool use. The process keeps running but emits no further stdout — no more tokens and no final result message. The parent harness is left with a live session that never completes and cannot be aborted gracefully.

Fix Action

Fixed

Code Example

AbortError:
    at A (/$bunfs/root/src/entrypoints/cli.js:9486:473)
    at z (/$bunfs/root/src/entrypoints/cli.js:2881:186)
Error in hook callback hook_1:
AbortError:
    at A (/$bunfs/root/src/entrypoints/cli.js:9486:473)

---

async sendRequest(H,$,q,K=...){
  let _={type:"control_request",request_id:K,request:H};
  if(this.inputClosed) throw Error("Stream closed");
  if(q?.aborted)       throw Error("Request aborted");
  ...
}
RAW_BUFFERClick to expand / collapse

Summary

When the CLI runs as a subprocess (observed via Claude Desktop's local-agent / Cowork mode on Linux, but the failure is inside the CLI itself), a turn stalls mid-stream after a tool use. The process keeps running but emits no further stdout — no more tokens and no final result message. The parent harness is left with a live session that never completes and cannot be aborted gracefully.

Evidence (CLI stderr captured by the host)

AbortError:
    at A (/$bunfs/root/src/entrypoints/cli.js:9486:473)
    at z (/$bunfs/root/src/entrypoints/cli.js:2881:186)
Error in hook callback hook_1:
AbortError:
    at A (/$bunfs/root/src/entrypoints/cli.js:9486:473)

cli.js:9486 is in the sendRequest control-request path:

async sendRequest(H,$,q,K=...){
  let _={type:"control_request",request_id:K,request:H};
  if(this.inputClosed) throw Error("Stream closed");
  if(q?.aborted)       throw Error("Request aborted");
  ...
}

Captured context at the stall: hadFirstResponse=true, last_message_type=assistant, last_tool_name=Write. So it happens after a tool use, while a hook callback / control request is in flight. An AbortError is thrown and not recovered; the query never resumes and never surfaces a terminal error.

Impact

  • The stream silently wedges; no result message is ever emitted, so the host shows a running session with a live timer and zero output.
  • More frequent under concurrency (multiple subagents) — roughly 1 in 10 spawned subagents stalls; single turns less often.
  • Host-side abort does not unwedge it: query.interrupt() does not resolve within 1500ms, and the host must hard-kill the subprocess to recover. Partial output is lost.

Likely related

  • #51851 — sendRequest throws permanently after inputClosed flips, with no reset path (same sendRequest wedge, different trigger).
  • #28405 (closed) — hook_callback control-request parse failure in the same surface.

Expected

An AbortError raised in a hook callback / control request should either be recovered (resume the stream) or terminate the turn with a surfaced error plus a final result/error message — it should never leave the query hung with no output and no way to abort.

Environment

  • CLI: bundled bun binary shipped inside Claude Desktop (Linux, aaddrick/claude-desktop-debian build) 1.8555.2.
  • Onset: stalls began ~2026-05-12.

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 AbortError in hook callback wedges query mid-stream; stdout silent, no result, no recovery [1 pull requests]