[BUG] Native binary REPL immediately exits on Terminus SSH terminal (SIGPIPE/EPIPE on stdout)

Resolved 💬 3 comments Opened Feb 12, 2026 by rhombicit Closed Feb 16, 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?

After migrating from the NPM-based installation to the native binary installation,
Claude Code's interactive REPL immediately exits after displaying the startup banner.
No error is shown to the user — it silently drops back to the shell.

Non-interactive mode (claude -p "hello") works perfectly. The issue is isolated to
the interactive TUI/REPL.

Root Cause (via strace):

The native binary receives EPIPE (broken pipe) when writing to stdout, followed by
SIGPIPE, and then stdin returns EOF:

What Should Happen?

Claude should enter interactive mode without immediately crashing

Error Messages/Logs

write(1, "INFO: Successfully connected to "..., 43) = -1 EPIPE (Broken pipe)
--- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=7140, si_uid=1001} ---
read(0, "", 65536) = 0    ← stdin EOF


The NPM-based installation (via Node.js) handled this gracefully and worked fine on 
the same terminal. The native binary does not handle SIGPIPE, causing instant exit.

**Debug log shows no errors** — authentication succeeds, REPL mounts, plugins load, 
everything initializes normally before the crash.

**Workarounds attempted (all failed):**
- `printf '\e[?1004l'` (disable focus events) → still exits
- `script -q -c claude /dev/null` (PTY wrapper) → still exits
- `TERM=dumb claude` → still exits
- `TERM=vt100 claude` → still exits
- `env -i HOME=$HOME PATH=$PATH TERM=$TERM claude` (clean env) → still exits
- Unsetting ANTHROPIC_API_KEY → still exits

**What works:**
- `claude -p "say hello"` (non-interactive mode) → works perfectly
- NPM installation on the same terminal → worked fine before migration

**Note:** Terminus sends terminal focus events (`^[[O` / `^[[I` — focus-out/focus-in) 
which appear in raw stdin. This may be what triggers the EPIPE, but the native binary 
should handle SIGPIPE gracefully like the Node.js version did.

Steps to Reproduce

  1. Install Claude Code native binary on a Linux EC2 instance
  2. SSH into the instance using Terminus (iOS SSH terminal app)
  3. Run claude
  4. Observe: banner displays, REPL prompt appears momentarily, then immediately exits
  5. Run claude -p "hello" — works fine
  6. Run strace -f -e trace=read,write,ioctl,close -o /tmp/trace.txt claude

shows EPIPE on stdout write followed by SIGPIPE and stdin EOF

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

es — the NPM-based installation (npm install -g @anthropic-ai/claude-code) worked correctly on the same Terminus terminal. The issue appeared after migrating to the native binary installation.

Claude Code Version

Opus4.6

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

After migrating from the NPM-based installation to the native binary installation,
Claude Code's interactive REPL immediately exits after displaying the startup banner.
No error is shown to the user — it silently drops back to the shell.

Non-interactive mode (claude -p "hello") works perfectly. The issue is isolated to
the interactive TUI/REPL.

Root Cause (via strace):

The native binary receives EPIPE (broken pipe) when writing to stdout, followed by
SIGPIPE, and then stdin returns EOF:-

  • Claude Code version: 2.1.39 (native binary)
  • OS: Amazon Linux 2023 (EC2 instance)
  • Shell: bash
  • Terminal: Terminus (iOS SSH client) connecting via SSH
  • TERM: xterm-256color
  • Node: v20.19.6 (via nvm, but not used by native binary)
  • Auth: Claude Max (OAuth)
  • Installation path: ~/.local/bin/claude

View original on GitHub ↗

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