Teams tmux mode fails in tcsh/csh: inline env var syntax not portable
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:
- PaneBackendExecutor.spawn() — dynamic env vars via template literal
- Splitpane spawn function — literal
&& CLAUDECODE=1 CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - 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
- Use a machine with tcsh as the default shell
- Start Claude Code inside tmux (or let it spawn tmux)
- Trigger a teams operation that spawns agents in tmux/pane mode
- 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.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗