Skip to content

Plandex fails with "Unsupported terminal" error inside tmux #320

Description

@jacob7395

Description

I'm still experiencing the same issue as #28. When running plandex commands that need the keyboard inside a tmux session. The same command works fine when running directly in my terminal (Ghostty) without tmux.

Error Output

❯ plandex models custom
A new version of Plandex is available: 2.2.1
Current version: 2.1.2
🧠 Example models file → /home/<user>/.plandex-home-v2/accounts/05386986-5155-4999-8a6b-41e8afcc9fa6/custom-models.json
👨‍💻 Edit it, then come back here to save

📝 Opened in editor

                         🚨 Error confirming
  → Failed to get user input
    → Failed to open keyboard
      → Error while reading terminfo data:termbox
        → Unsupported terminal

Environment

Field Value
OS NixOS 25.11 (WSL2, Linux 6.6.87.2-microsoft-standard-WSL2, x86_64)
Plandex version 2.1.2
Shell zsh 5.9
TERM (in tmux) tmux-256color
TERM (outside tmux) xterm-ghostty
Terminal emulator Ghostty 1.2.3

Root Cause

The error originates from the eiannone/keyboard library (used in term/prompt.goGetUserKeyInput()keyboard.Open()). This library has its own terminfo parser that searches for the terminfo entry matching $TERM in this order:

  1. $TERMINFO — if set, used as the exclusive search path (no other locations are checked)
  2. ~/.terminfo/
  3. $TERMINFO_DIRS — colon-separated list of directories
  4. /lib/terminfo
  5. /usr/share/terminfo

If the file lookup fails, it falls back to built-in definitions for: xterm, xterm-256color, screen, rxvt-unicode, rxvt-256color, linux, Eterm — plus substring matching (e.g. if $TERM contains "xterm" or "screen").

In my case, Ghostty sets $TERMINFO to its own terminfo directory (which only contains Ghostty's entries, not tmux-256color). Because $TERMINFO is set, the library uses it exclusively and never checks $TERMINFO_DIRS or standard system paths where tmux-256color actually exists.

Since tmux-256color also doesn't match any built-in definition or substring pattern, both lookup strategies fail → "Unsupported terminal".

This will affect anyone whose terminal emulator sets $TERMINFO to a directory that doesn't include tmux's terminfo entries.

Resolution

Unsetting $TERMINFO inside tmux config resolves the issue. In tmux config:

set-environment -g -u TERMINFO

This allows the keyboard library to fall through to $TERMINFO_DIRS and standard system paths, where tmux-256color is available. I did not need to set $TERMINFO_DIRS in my config, not sure if this is being set my by tmux or something that the nixos package is setting. Either what this is what my TERMINFO_DIRS is set to:

echo $TERMINFO_DIRS
/home/<user>/.nix-profile/share/terminfo:/nix/profile/share/terminfo:/home/<user>/.local/state/nix/profile/share/terminfo:/etc/profiles/per-user/<user>/share/terminfo:/nix/var/nix/profiles/default/share/terminfo:/run/current-system/sw/share/terminfo

Documentation

I'd be happy to contribute a docs page covering tmux integration and this terminfo interaction if you can point me to the best place to add it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions