[BUG] Issue running multiple claude code terminals sessions simultaneously
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?
When running many native Claude Code CLI sessions in parallel on macOS, a significant fraction stop mid-processing.
In interactive TUI usage this appears as sessions halting unexpectedly. In a reproducible non-interactive load test (claude -p), failures show up as subtype: error_during_execution with result: null.
This is specifically triggered under higher concurrency (10-way bursts). Lower concurrency is usually stable.
What Should Happen?
All sessions should complete reliably for trivial prompts under 10-way parallel load, or return a clear actionable error if capacity is exceeded. Sessions should not silently stop with result: null in normal operation.
Error Messages/Logs
Sample failure payload from native CLI under 10-way parallel run:
{
"type": "result",
"subtype": "error_during_execution",
"is_error": false,
"duration_ms": 30066,
"duration_api_ms": 30029,
"result": null
}
Observed aggregate results (same machine/account):
- Native CLI (user settings): 5 rounds x 10 concurrent => `36/50` success
- round results: `8/10, 7/10, 7/10, 7/10, 7/10`
- Native CLI control (`--setting-sources local`): 5 rounds x 10 concurrent => `50/50` success
- Native CLI low concurrency control (2 workers, 10 total calls) => `10/10` success
Steps to Reproduce
- On macOS, install latest Claude Code and verify:
``shell``
claude --version
- Use user-level Claude settings with custom env routing (redacted token):
``json``
{
"env": {
"API_TIMEOUT_MS": "300000",
"ANTHROPIC_BASE_URL": "http://127.0.0.1:8000",
"ANTHROPIC_AUTH_TOKEN": "<redacted>",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "antigravity/claude-sonnet-4.5"
},
"model": "opus"
}
- Run this concurrent repro script:
```shell
python3 - <<'PY'
import concurrent.futures, subprocess, json
cmd = ["claude", "-p", "--model", "sonnet", "--output-format", "json", "Reply with exactly OK"]
def one():
p = subprocess.run(cmd, capture_output=True, text=True, timeout=180)
if p.returncode != 0:
return False, f"exit={p.returncode}"
d = json.loads(p.stdout)
ok = d.get("subtype") == "success" and str(d.get("result", "")).strip() == "OK"
return ok, d.get("subtype")
for r in range(1, 6):
with concurrent.futures.ThreadPoolExecutor(max_workers=10) as ex:
out = [f.result() for f in [ex.submit(one) for _ in range(10)]]
ok = sum(1 for s, _ in out if s)
print(f"round{r} ok={ok}/10")
if ok < 10:
print(" sample_fail=", [x for x in out if not x[0]][0])
PY
```
- Observe intermittent failures with
error_during_executionand null result.
- Control check (same machine): rerun with
--setting-sources localand observe stable completion.
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
Unknown
Claude Code Version
2.1.39 (Claude Code) (Also observed previously on 2.1.38.)
Platform
Other
Operating System
macOS
Terminal/Shell
Other
Additional Information
- This does not appear to be a simple rate-limit case from user-side observation.
claude --doctorprovided environment info but did not surface a direct cause for this high-concurrency failure mode.- Comparison point: running equivalent parallel tasks through CodeLayer/HumanLayer orchestration path on the same machine completes reliably in local tests, suggesting a native CLI concurrency/runtime-path sensitivity.
- Request: guidance/fix for native CLI/TUI reliability under 10 concurrent sessions, especially when using custom
ANTHROPIC_BASE_URLand user settings.
Terminal is Ghostty
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗