Teams tmux mode fails in tcsh/csh: inline env var syntax not portable

Resolved 💬 1 comment Opened Feb 12, 2026 by ss111628 Closed Feb 12, 2026

Bug Description

When using Claude Code teams in tmux mode (not in-process mode), spawned agent commands fail with CLAUDECODE=1: Command not found. on tcsh/csh shells.

In-process mode works fine. Only tmux/pane mode is affected.

Root Cause

The tmux spawn code constructs commands using bash-style inline environment variables:

cd /home/user && CLAUDECODE=1 CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 /path/to/claude --agent-id ...

This VAR=value command syntax is bash/zsh-specific. In tcsh/csh, CLAUDECODE=1 is interpreted as a command name, producing:

CLAUDECODE=1: Command not found.

Fix

Prefix with env, which is POSIX-portable and works in all shells (bash, zsh, tcsh, csh, fish):

cd /home/user && env CLAUDECODE=1 CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 /path/to/claude --agent-id ...

There are 3 locations in cli.js (v2.1.39) that need this:

  1. PaneBackendExecutor.spawn() — dynamic env vars via template literal
  2. Splitpane spawn function — literal && CLAUDECODE=1 CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
  3. Non-splitpane tmux spawn function — same literal pattern

Environment

  • Claude Code v2.1.39
  • Shell: tcsh 6.20.00 (Rocky Linux 8) and tcsh 6.18.01 (CentOS 7)
  • /bin/sh -> bash on both systems
  • Node.js v23.6.0

Steps to Reproduce

  1. Use a machine with tcsh as the default shell
  2. Start Claude Code inside tmux (or let it spawn tmux)
  3. Trigger a teams operation that spawns agents in tmux/pane mode
  4. All agent panes fail with CLAUDECODE=1: Command not found.

Workaround

Patch cli.js to replace && CLAUDECODE=1 with && env CLAUDECODE=1 (and the equivalent dynamic pattern in PaneBackendExecutor). Patch is lost on Claude Code updates.

View original on GitHub ↗

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