Hmbown/CodeWhale · error

tmux attach unavailable

Error message

tmux attach unavailable

What it means

When the tmux attach backend could not even exec the `tmux` binary (`status()` returned `Err(err)`), the code prints the exec error to stderr, helpfully prints the attach command to stdout so the user can run it elsewhere, and fails with 'tmux attach unavailable'. This signals tmux is not installed or not executable in the current environment.

Solutions

  1. Install tmux (e.g. `apt install tmux`, `brew install tmux`) and retry the attach.
  2. Use the attach command printed to stdout to attach manually from a shell where tmux IS available.
  3. Fix PATH in the environment running codewhale so `tmux` is resolvable.

Example fix

// before
$ codewhale lane attach lane-1
error: tmux attach unavailable
// after
$ sudo apt install tmux
$ codewhale lane attach lane-1
Defensive patterns

Strategy: fallback

Validate before calling

const which = spawnSync('which', ['tmux']);
if (which.status !== 0) throw new Error('tmux is not installed; install it or use the printed attach command manually');

Prevention

When it happens

Trigger: `tmux` binary missing from PATH, not executable, or `Command::status` fails for any OS reason (e.g. PATH stripped in the execution environment, broken installation).

Common situations: Minimal containers/CI images without tmux installed; tmux installed under a nonstandard path not in PATH; running codewhale via a service with a restricted PATH.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/1dd98c6a2a0c12e9. Report an issue: GitHub.

Appendix: source

Thrown at crates/cli/src/lib.rs:980

                return Ok(());
            }
            if let Some(session) = lane.tmux_session.as_deref() {
                let socket = lane
                    .tmux_socket
                    .as_deref()
                    .context("tmux lane is missing its pinned server socket")?;
                let status = Command::new("tmux")
                    .arg("-S")
                    .arg(socket)
                    .args(["attach", "-t", session])
                    .status();
                match status {
                    Ok(s) if s.success() => Ok(()),
                    Ok(s) => bail!("tmux attach failed ({s}); command was: {attach}"),
                    Err(err) => {
                        eprintln!("could not exec tmux: {err}");
                        println!("{attach}");
                        bail!("tmux attach unavailable");
                    }
                }
            } else {
                println!("{attach}");
                Ok(())
            }
        }
        LaneCommand::Logs {
            lane_id,
            follow,
            tail,
        } => {
            let reg = LaneRegistry::open_default()?;
            let lane = reg.load(&lane_id)?;
            let path = lane.log_path;
            if !path.exists() {
                bail!("log file missing: {}", path.display());
            }

View on GitHub (pinned to 73e0f67d83)