[BUG] Agent teammate pane creation fails with "size invalid" on headless server via SSH+tmux
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?
Spawning an Agent teammate (via the Agent tool with team_name) fails with "Failed to create teammate pane: create pane failed: size invalid" when running in a headless SSH+tmux environment. $COLUMNS and $LINES are 0 because there is no TTY, causing Claude Code to calculate an invalid pane split size.
What Should Happen?
Teammate pane creation should succeed, either by falling back to tput cols/tput lines or tmux dimension queries when $COLUMNS/$LINES are unset or zero.
Error Messages/Logs
Failed to create teammate pane: create pane failed: size invalid
Steps to Reproduce
- SSH into a headless Linux server with a running tmux session
- Attach to the tmux session — confirm
$COLUMNSand$LINESare0or unset (echo $COLUMNS $LINES) - Launch Claude Code
- Use the
Agenttool with ateam_nameto spawn a teammate - Observe:
Failed to create teammate pane: create pane failed: size invalid
Note: tput cols/tput lines correctly return the tmux window dimensions (e.g., 270×136), but Claude Code reads $COLUMNS/$LINES which are 0 in this environment because there is no TTY attached.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_N/A_
Claude Code Version
2.1.78 (Claude Code)
Platform
Anthropic API
Operating System
Other Linux (RHEL 8)
Terminal/Shell
Other — tmux on a headless server accessed via SSH (TERM=screen-256color)
Additional Information
Environment details:
COLUMNS=0,LINES=0— not exported in shell env (no TTY in this context)stty sizefails:stty: 'standard input': Inappropriate ioctl for devicetput cols/tput linesreturn correct values (270×136 from tmux)TERM=screen-256color
Partial workaround: Setting export COLUMNS=$(tput cols) LINES=$(tput lines) before launching Claude Code fixes TeamCreate directly, but does not fix Agent teammate pane creation — suggesting the subprocess either doesn't inherit the manually-set env vars, or re-queries terminal dimensions independently.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗