Headless `claude -p` runs stall for a constant ~405s early in every session (9/9 since 2026-08-03, v2.1.220 + v2.1.221)

Status Open
Reported on v2.1.220
Maintainer reply None cached
Activity 1 comment · opened Aug 4, 2026

Summary

Headless claude -p runs from this machine/account hang for an almost perfectly constant ~405 seconds (observed 398–412s) exactly once per session, early in the run, and then continue normally. It has happened on 9 out of 9 headless runs since 2026-08-03, across two CLI versions, at different times of day. Before 2026-08-03, the same workload ran 22 times over four weeks with no stall (the same point in the session measured 2–20s).

The near-constant duration suggests a fixed timeout/retry constant somewhere in the stack (e.g. a hung connection that takes ~6¾ minutes to be abandoned), not load-dependent latency.

Environment

  • Claude Code 2.1.220 and 2.1.221 (auto-updated 2026-08-03 evening; stall occurs on both)
  • macOS (Darwin 25.3.0), Apple Silicon
  • Invocation: claude -p --model claude-sonnet-5 --output-format text --allowedTools WebSearch,WebFetch, prompt on stdin (~30k chars), launched non-interactively (launchd and manual shell both affected)
  • Subscription auth (no API key)

Behavior

Each affected session's transcript JSONL shows one gap with zero events for ~405s; before and after the gap the session is completely normal (24–36 WebSearch calls at ~7s median latency, identical to the pre-08-03 baseline). In most runs the gap begins immediately after the round trip that loads the deferred WebSearch/WebFetch tools (they are deferred in these versions, so every run loads them); in the most recent run the gap began ~16s into the session, right after the initial user turn.

Occurrences

| Date (2026) | Run | Stall duration |
|---|---|---|
| 08-03 | scheduled run 1–4 (07:35–08:31 CT) | 406s / 412s / 398s / 408s |
| 08-04 | scheduled run 1–4 (07:35–08:32 CT) | 405–409s (within 3.6s of each other) |
| 08-04 | manual replay 09:34 CT | 404.8s (14:34:19Z → 14:41:04Z) |

No other Claude sessions were active during the 08-04 runs (concurrency ruled out). The prompt, tools, and argv are unchanged from the 22 clean runs (2026-07-03 → 07-31).

Impact

Any headless run with a wall-clock budget dies: these sessions previously completed in ~6 minutes; with the stall they need ~12, so a 10-minute subprocess timeout killed every scheduled run for two days. Working around it by raising the budget, but the stall itself persists.

Repro / diagnostics

Reproduces on every headless run with WebSearch/WebFetch from this environment since 08-03, any time of day. Session IDs and transcript timing data available on request — happy to share privately.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗