[BUG] Agent teammate pane creation fails with "size invalid" on headless server via SSH+tmux

Resolved 💬 2 comments Opened Mar 18, 2026 by ryan-born-leo Closed Apr 15, 2026

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

  1. SSH into a headless Linux server with a running tmux session
  2. Attach to the tmux session — confirm $COLUMNS and $LINES are 0 or unset (echo $COLUMNS $LINES)
  3. Launch Claude Code
  4. Use the Agent tool with a team_name to spawn a teammate
  5. 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 size fails: stty: 'standard input': Inappropriate ioctl for device
  • tput cols / tput lines return 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.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗