claude-code - 💡(How to fix) Fix [BUG] Teammate subprocess exits code 1 silently before debug init (tmux send-keys backend) [1 comments, 2 participants]

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…
GitHub stats
anthropics/claude-code#46349Fetched 2026-04-11 06:22:37
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

When spawning a teammate via the Agent tool with team_name, the tmux backend creates a pane and sends the launch command via send-keys. The claude binary starts but exits immediately with code 1 — no stdout, no stderr, no debug log created (even with --debug-file). The failure happens before the debug/logging subsystem initializes.

This is 100% reproducible — every auto-launch via send-keys fails. Manual execution of the identical command in the same pane always succeeds.

Error Message

[ERROR] NON-FATAL: Lock acquisition failed for .../2.1.100 (expected in multi-process scenarios) 2. If startup fails, error should be surfaced (stderr, exit message, or debug log)

Root Cause

Related issues

  • #40168 — shell-not-ready race condition (related but distinct; our shell IS ready)
  • #42391 — 255-byte command truncation (different root cause)
  • #46008 — API key env inheritance (possibly related if auth fails pre-debug-init)
  • #38048 — teammateMode config ignored (we also reproduce this)

Code Example

cd /Users/.../workbench && env CLAUDECODE=1 ... claude --agent-id probe@test ...

workbench on main [?]
% cd /Users/.../workbench && env CLAUDECODE=1 ... claude --agent-id probe@test ...

workbench on main [?]
%

---

[DEBUG] MDM settings load completed in 0ms
[DEBUG] [STARTUP] Running setup()...
[ERROR] NON-FATAL: Lock acquisition failed for .../2.1.100 (expected in multi-process scenarios)
[DEBUG] [STARTUP] setup() completed in 33ms
[DEBUG] [Reconnection] Computed initial team context for teammate...
[DEBUG] [TeammateMailbox] readMailbox...
RAW_BUFFERClick to expand / collapse

[BUG] Teammate subprocess exits with code 1 silently before debug system initializes (tmux send-keys backend)

Environment

  • Claude Code v2.1.100
  • macOS Darwin 24.6.0 (Apple Silicon)
  • tmux 3.6a
  • zsh with ~1.5s startup time
  • CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 enabled

Description

When spawning a teammate via the Agent tool with team_name, the tmux backend creates a pane and sends the launch command via send-keys. The claude binary starts but exits immediately with code 1 — no stdout, no stderr, no debug log created (even with --debug-file). The failure happens before the debug/logging subsystem initializes.

This is 100% reproducible — every auto-launch via send-keys fails. Manual execution of the identical command in the same pane always succeeds.

Related issues

  • #40168 — shell-not-ready race condition (related but distinct; our shell IS ready)
  • #42391 — 255-byte command truncation (different root cause)
  • #46008 — API key env inheritance (possibly related if auth fails pre-debug-init)
  • #38048 — teammateMode config ignored (we also reproduce this)

Reproduction steps

  1. Start claude inside a tmux session (tmux new-session -s claude && claude)
  2. Enable teams: CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in settings
  3. Create a team via TeamCreate
  4. Spawn a teammate via Agent tool with team_name and name parameters
  5. Observe: new tmux pane appears, command runs twice, exits to bare shell both times

Evidence collected

What works vs. what doesn't:

Launch methodWorks?Detail
tmux split-window "env ... claude --agent-id ..."YesBinary runs as pane's initial process
tmux send-keys (manual, shell warm)YesTyped into interactive shell after prompt
Auto-launch via Agent tool (send-keys)NoExit code 1, no output, every time

Pane buffer from failed auto-launch:

cd /Users/.../workbench && env CLAUDECODE=1 ... claude --agent-id probe@test ...

workbench on main [?]
% cd /Users/.../workbench && env CLAUDECODE=1 ... claude --agent-id probe@test ...

workbench on main [?]
%

Command sent twice (retry), both exit silently. No TUI banner rendered.

Intercepted via zsh preexec hook:

  • EXIT CODE: 1
  • stdout: empty
  • stderr: empty
  • --debug-file /tmp/debug.log added to command — file never created
  • Binary exits before debug system initializes (~first 50ms of startup)

Successful manual run debug log shows:

[DEBUG] MDM settings load completed in 0ms
[DEBUG] [STARTUP] Running setup()...
[ERROR] NON-FATAL: Lock acquisition failed for .../2.1.100 (expected in multi-process scenarios)
[DEBUG] [STARTUP] setup() completed in 33ms
[DEBUG] [Reconnection] Computed initial team context for teammate...
[DEBUG] [TeammateMailbox] readMailbox...

All of this happens in the manual (working) run but NONE of it happens in the auto-launch — the binary exits before any of it.

Additional bug: teammateMode config ignored

Setting "teammateMode": "in-process" in ~/.claude.json has no effect. The backend always resolves to tmux regardless of:

  • Being outside tmux ($TMUX not set)
  • Explicit config in ~/.claude.json
  • Team config showing backendType: "tmux" even when no tmux is available

The earlier debug log confirms: [BackendRegistry] isInProcessEnabled: false (mode=auto, insideTmux=true) — the snapshot reads auto even after config was set to in-process.

Expected behavior

  1. Teammate binary should start and connect to the team mailbox
  2. If startup fails, error should be surfaced (stderr, exit message, or debug log)
  3. teammateMode: "in-process" should be respected

Suggested fix

The tmux backend should use tmux split-window -t ... "cd /path && env ... claude ..." (command as pane argument) instead of split-window + send-keys. We proved this works on every attempt.

extent analysis

TL;DR

The most likely fix is to modify the tmux backend to use tmux split-window with the command as a pane argument instead of split-window followed by send-keys.

Guidance

  • Verify that the tmux command is being executed correctly by checking the tmux version and configuration.
  • Test the suggested fix by replacing send-keys with tmux split-window -t ... "cd /path && env ... claude ..." and observe if the teammate binary starts and connects to the team mailbox successfully.
  • Investigate why the teammateMode config is being ignored and ensure that the ~/.claude.json file is being read correctly.
  • Check the debug log of a successful manual run to understand the expected behavior and compare it with the failed auto-launch attempt.

Example

# Replace send-keys with split-window
tmux split-window -t ... "cd /path && env ... claude ..."

This command should be used in the tmux backend to launch the teammate binary.

Notes

The issue seems to be related to the way the tmux backend is launching the teammate binary. The suggested fix is based on the provided evidence that using tmux split-window with the command as a pane argument works successfully. However, the root cause of the teammateMode config being ignored is still unclear and requires further investigation.

Recommendation

Apply the suggested fix by modifying the tmux backend to use tmux split-window with the command as a pane argument. This should resolve the issue of the teammate binary exiting silently before the debug system initializes.

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…

FAQ

Expected behavior

  1. Teammate binary should start and connect to the team mailbox
  2. If startup fails, error should be surfaced (stderr, exit message, or debug log)
  3. teammateMode: "in-process" should be respected

Still need to ship something?

×6

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

Back to top recommendations

TRENDING