Skip to content

PTY mode fails on tmux 3.2a with ERR_TMUX_SWITCH_FAILED and display-message usage error #156

Description

@and-rewsmith

Description

Agentboard starts successfully and the browser WebSocket connects, but opening any tmux window fails in the default pty terminal mode with:

ERR_TMUX_SWITCH_FAILED
usage: display-message [-aINpv] [-c target-client] [-d delay]
[-F format] [-t target-pane] [message]

Deleting all tmux sessions and recreating a clean session does not resolve the problem.

Environment

  • OS: Linux x86_64
  • Agentboard: @gbasin/agentboard@0.4.4
  • Native package: @gbasin/agentboard-linux-x64@0.4.4
  • Node: v20.19.4
  • tmux: 3.2a
  • Terminal mode: pty
  • Browser client: Chrome 149 on macOS

Steps to reproduce

  1. Create a tmux session:

    tmux new-session -d -s agent
  2. Start Agentboard:

    LOG_LEVEL=debug HOSTNAME=0.0.0.0 agentboard
  3. Open the Agentboard web interface.

  4. Select the agent tmux window.

Actual result

The debug log reports:

{"connectionId":"cd1ad840-3c85-44d0-b2dd-5bfec4dddfdb","sessionName":"agentboard-ws-cd1ad840-3c85-44d0-b2dd-5bfec4dddfdb","clientTty":"/dev/pts/3","durationMs":42,"mode":"pty","event":"terminal_proxy_ready"}

{"connectionId":"cd1ad840-3c85-44d0-b2dd-5bfec4dddfdb","sessionName":"agentboard-ws-cd1ad840-3c85-44d0-b2dd-5bfec4dddfdb","tmuxWindow":"agent:@0","effectiveTarget":"agent:@0","clientTty":"/dev/pts/3","mode":"pty","event":"terminal_switch_attempt"}

{"connectionId":"cd1ad840-3c85-44d0-b2dd-5bfec4dddfdb","sessionName":"agentboard-ws-cd1ad840-3c85-44d0-b2dd-5bfec4dddfdb","tmuxWindow":"agent:@0","effectiveTarget":"agent:@0","clientTty":"/dev/pts/3","error":"usage: display-message [-aINpv] [-c target-client] [-d delay] [-F format] [-t target-pane] [message]\n","mode":"pty","event":"terminal_switch_failure"}

After the failure:

tmux list-clients

returns no clients.

The Agentboard-created temporary tmux client is discovered successfully as /dev/pts/3, but the terminal switch fails and the client disappears.

Expected result

The browser terminal should attach to and display agent:@0.

Manual tmux verification

The equivalent target-identity commands work correctly when run manually:

target='agent:@0'
fmt=$'#{session_name}\t#{window_id}'

tmux -u display-message -p -t "$target" "$fmt"
echo "exit=$?"

tmux -u display-message -p -t "$target" -F "$fmt"
echo "exit=$?"

Both commands output:

agent	@0

and exit with status 0.

Additional manual tests also succeed:

tmux display-message -p -t 'agent:@0' '#{session_name}'
tmux -u display-message -p -t 'agent:@0' '#{session_name}'
tmux -u display-message -p -t 'agent:@0' '#{window_id}'
tmux -u display-message -p -t 'agent:@0' '#{session_name} #{window_id}'
tmux -u display-message -p -t 'agent:@0' $'#{session_name}\t#{window_id}'

Installed packages

@gbasin/agentboard@0.4.4
@gbasin/agentboard-linux-x64@0.4.4
tmux 3.2a

The npm dependency tree also reports an apparently unrelated xterm peer-dependency issue:

npm error invalid: @xterm/xterm@5.5.0

Agentboard still starts successfully and reaches the tmux terminal-switch code, so this does not appear to be the direct cause of the tmux failure.

pipe-pane behavior

TERMINAL_MODE=pipe-pane avoids the PTY switch error, but it is not a usable workaround in my environment because the terminal does not render at full width on my devices.

Example:

HOSTNAME=0.0.0.0 TERMINAL_MODE=pipe-pane agentboard

The server starts in pipe-pane mode, but the browser terminal layout is incorrectly sized and does not use the full available width.

Because of that rendering problem, neither available terminal mode is usable:

  • pty: fails with ERR_TMUX_SWITCH_FAILED
  • pipe-pane: terminal does not render at full width

Suspected area

This appears to involve the PTY client-switch verification lifecycle:

  1. Agentboard creates a temporary grouped tmux client.
  2. The client is discovered successfully at /dev/pts/3.
  3. Agentboard attempts to switch it to agent:@0.
  4. A display-message command returns its usage text.
  5. The temporary client exits or disappears.

The target itself is valid and the corresponding manual display-message commands succeed, so this may be a race condition or compatibility problem around switch-client, client identity verification, or the temporary PTY client lifecycle on tmux 3.2a.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions