[BUG] `claude -p` (print mode) returns empty output in v2.1.83 — regression from v2.1.81
Environment
- Claude Code version: 2.1.83 (broken), 2.1.81 (works), 2.1.79 (works)
- OS: macOS Darwin 25.3.0 (Apple Silicon, M-series)
- Shell: zsh (oh-my-zsh)
- Node: installed via Homebrew (
/opt/homebrew/bin) - Auth: OAuth (
claude.ai), Team subscription - Install method:
npm install -g @anthropic-ai/claude-code
Description
After upgrading from v2.1.81 to v2.1.83, claude -p (print/headless mode) returns empty stdout for all prompts — including trivially short ones. Interactive mode continues to work normally. Downgrading to v2.1.81 immediately resolves the issue.
Reproduction Steps
# Upgrade to 2.1.83
npm install -g @anthropic-ai/claude-code@2.1.83
# All of these return empty output:
claude -p "say hi"
claude -p "say hi" < /dev/null
echo "say hi" | claude -p
claude -p --model sonnet "say hi"
# Debug flag reveals error on stderr, but exit code is still 0:
claude -p --debug "say hi" 2>debug.log
# => Exit code: 1
# => stderr: "Error: Input must be provided either through stdin or as a prompt argument when using --print"
# Even piping (which should satisfy stdin requirement) produces empty output:
echo "say hi" | claude -p
# => (empty, exit code 0)
# --bare mode shows auth issue:
claude --bare -p "your prompt here"
# => "Not logged in - Please run /login"
# Downgrade fixes it immediately:
npm install -g @anthropic-ai/claude-code@2.1.81
claude -p "who are you"
# => Normal response returned
Observed Behavior
| Method | v2.1.81 | v2.1.83 |
|--------|---------|---------|
| claude -p "prompt" | Normal output | Empty, exit 0 |
| echo "prompt" \| claude -p | Normal output | Empty, exit 0 |
| claude -p --debug "prompt" | Normal output | "Error: Input must be provided either through stdin or as a prompt argument", exit 1 |
| claude --bare -p "prompt" | N/A | "Not logged in" |
| Interactive claude | Works | Works |
Impact
This is a breaking change for all claude -p automation pipelines. In our case, it silently broke a scheduled report generation system (launchd cron jobs calling claude -p --model sonnet --mcp-config ...):
- Reports generated as 0-1 line empty files
- Exit code 0 masked the failure — no error handling triggered
- Empty PDFs were generated and uploaded to Slack
- Multiple retry attempts all produced the same empty result
- Only discovered when end users reported blank reports
Key Observations
- Not a prompt size issue — even
"say hi"(6 chars) fails - Not an auth issue —
claude auth statusreturnsloggedIn: true, and interactive mode works fine with the same session - Not a stdin issue — both positional argument and stdin pipe fail
- Exit code is misleading — returns 0 (success) despite producing no output, except when
--debugis enabled (then returns 1 with error message) - Regression is narrow — v2.1.81 works, v2.1.83 broken (v2.1.82 was not published)
Expected Behavior
claude -p "prompt" should return the model's response on stdout, as it does in v2.1.81 and earlier.
Workaround
Downgrade to v2.1.81:
npm install -g @anthropic-ai/claude-code@2.1.81This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗