[BUG] Background agents: every daemon-spawned worker crashes "exit 1 before init" (macOS arm64)
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?
Summary
Every background-agent worker spawned by the on-demand daemon crashes immediately
with exit 1 before init. The Agents view and claude --bg are completely
unusable — no background session can start, and existing ones can't be resumed.
Interactive claude is unaffected.
Ruled out
- Not auth. The daemon separately hit
auth_required(expired OAuth, headless
daemon can't refresh). Re-login + daemon restart fixed auth — the fresh daemon
authenticates cleanly — but workers still crash identically.
- Not a version regression. First seen on 2.1.142; persists on 2.1.143
(reported latest by claude update).
- Not system Bun. Updating system Bun to latest had no effect — consistent
with the crash being in the Bun runtime embedded in the compiled binary.
- Not project config. All
settings.jsonfiles valid;claude -pfrom the
same cwd runs fine (full startup, exit 0); interactive claude is unaffected.
### Secondary issue
The crash detail stored in state.json is truncated (leading …) — the actual
error message and earlier stack frames are cut off, so a user has no way to see
what actually threw. The daemon should persist the full worker stderr.
What Should Happen?
Expected vs actual
Expected: the worker starts and runs the session.
Actual: the worker exits 1 before init; the daemon logs bg settled <id> (crashed)
~60–500ms after bg spare spawned host.
Error Messages/Logs
### daemon.log excerpt
[2026-05-16T06:00:32.913Z] [supervisor] ─── daemon start ─── version=2.1.143 pid=92076 origin=transient
[2026-05-16T06:00:33.050Z] [bg] bg spare spawned host pid=92103
[2026-05-16T06:00:33.161Z] [bg] bg claimed-spare 66c5da22 (spare)
[2026-05-16T06:00:33.615Z] [bg] bg settled 66c5da22 (crashed)
[2026-05-16T06:00:54.844Z] [bg] bg claimed-spare a433d7e5 (fleet)
[2026-05-16T06:00:54.851Z] [bg] bg spare spawned host pid=92410
[2026-05-16T06:00:54.915Z] [bg] bg settled a433d7e5 (crashed)
Steps to Reproduce
Reproduction
- Run
claude --bg "reply with the single word OK"(any prompt). - The job is created, then fails within ~100ms.
claude logs <id>→job not found — it may have already exited.~/.claude/jobs/<id>/state.jsonshows:
````
exit 1 before init — …at uSK (/$bunfs/root/src/entrypoints/cli.js:9092:233) at async SKO (/$bunfs/root/src/entrypoints/cli.js:19558:68) at async h4O (/$bunfs/root/src/entrypoints/cli.js:19595:313) Bun v1.3.14 (macOS arm64)
100% reproducible. Also affects pre-warmed "spare" workers (no session/job
attached) and resuming existing Agents-view chats.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.143 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗