CLI crashes in headless/stream-json mode (Ink raw mode error) - breaks Desktop remote SSH" --body-file /path/to/the/file
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?
Claude Code CLI crashes in headless/stream-json mode (Ink raw mode error)
Description
Claude Code CLI crashes immediately when launched in headless mode with --output-format stream-json --input-format stream-json and no TTY attached. This breaks Claude Desktop's remote SSH connections, as Desktop launches the remote CLI (ccd-cli) in exactly this mode.
Interactive mode works perfectly — only the headless/piped execution path is affected.
Reproduction
# This crashes immediately with exit code 1:
printf '{"request_id":"test","type":"control_request","request":{"subtype":"initialize","hooks":{}}}\n' \
| setsid claude --output-format stream-json --input-format stream-json 2>&1
Error output
ERROR Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.
Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported
- handleSetRawMode (/$bunfs/root/src/entrypoints/cli.js:716:1946)
- <anonymous> (/$bunfs/root/src/entrypoints/cli.js:723:3758)
- wg (/$bunfs/root/src/entrypoints/cli.js:678:63130)
- k7H (/$bunfs/root/src/entrypoints/cli.js:678:66416)
- TN (/$bunfs/root/src/entrypoints/cli.js:678:74300)
- k7H (/$bunfs/root/src/entrypoints/cli.js:678:67547)
- TN (/$bunfs/root/src/entrypoints/cli.js:678:74300)
- k7H (/$bunfs/root/src/entrypoints/cli.js:678:66403)
- TN (/$bunfs/root/src/entrypoints/cli.js:678:74300)
- k7H (/$bunfs/root/src/entrypoints/cli.js:678:66403)
- async <anonymous> (/$bunfs/root/src/entrypoints/cli.js:15224:435)
Impact
Claude Desktop connects to remote servers via SSH and launches /root/.claude/remote/ccd-cli in headless stream-json mode. Because the CLI crashes on startup, all Claude Desktop remote sessions fail with "Claude Code process exited with code 1" / "VM service not running. The service failed to start."
Environment
- CLI version: 2.1.78 and 2.1.79 (both affected)
- OS: Ubuntu 24.04.4 LTS (GNU/Linux 6.8.0-100-generic x86_64)
- Desktop app version: 1.1.7464.0 (Windows, fresh install)
- Node: v22.x
- Install method:
npm install -g @anthropic-ai/claude-code
Troubleshooting attempted
- Fresh reinstall of Claude Desktop (Windows)
- VPS reboot
- CLI upgrade from 2.1.78 → 2.1.79
- CLI downgrade to 2.1.72
- Deleting
/root/.claude/remote/to force re-provisioning - Replacing
ccd-clibinary with npm-installedclaudebinary - Wrapping
ccd-cliin ascript -qecPTY wrapper (changed error location from stderr to stdout but still exit code 1) - Removing all MCP servers and plugins from VPS config
Notes
- Interactive mode (
claudein a terminal) works perfectly - The remote server (
/root/.claude/remote/server) provisions and connects fine — only the CLI subprocess crashes settings.jsonon the VPS is empty ({}) — no custom MCP servers or plugins
What Should Happen?
Expected behaviour
When launched with --output-format stream-json --input-format stream-json and no TTY, the CLI should skip Ink's interactive rendering and operate in pure JSON streaming mode without requiring raw mode on stdin.
Error Messages/Logs
Steps to Reproduce
Fresh reinstall of Claude Desktop (Windows)
VPS reboot
CLI upgrade from 2.1.78 → 2.1.79
CLI downgrade to 2.1.72
Deleting /root/.claude/remote/ to force re-provisioning
Replacing ccd-cli binary with npm-installed claude binary
Wrapping ccd-cli in a script -qec PTY wrapper (changed error location from stderr to stdout but still exit code 1)
Removing all MCP servers and plugins from VPS config
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.79
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
Interactive mode (claude in a terminal) works perfectly
The remote server (/root/.claude/remote/server) provisions and connects fine — only the CLI subprocess crashes
settings.json on the VPS is empty ({}) — no custom MCP servers or plugins
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗