[BUG] v2.1.83: -p (print) mode returns empty result while tokens are generated and billed

Status Fixed / completed
Reported on v2.1.78
Maintainer reply None cached
Activity 3 comments · opened Mar 25, 2026 · closed Mar 25, 2026

Description

Claude Code CLI v2.1.83 in -p (print/non-interactive) mode returns empty text on stdout while tokens are generated and billed. The --output-format json confirms tokens are consumed (output_tokens: 12) and cost is charged (total_cost_usd: 0.08) but "result": "" is always empty.

Reproduction

claude --dangerously-skip-permissions -p "Say BANANA" < /dev/null
# Expected: "BANANA"
# Actual: empty (just a newline)

claude --dangerously-skip-permissions --output-format json -p "Say BANANA" < /dev/null
# Shows: "result":"", "output_tokens":12, "total_cost_usd":0.058

Workaround

Downgrading to v2.1.78 fixes the issue:

npm install -g @anthropic-ai/claude-code@2.1.78
/opt/homebrew/bin/claude --dangerously-skip-permissions -p "Say BANANA" < /dev/null
# Returns: "BANANA"

Environment

  • CLI Version: 2.1.83 (broken), 2.1.78 (works)
  • OS: macOS 15.5 (Apple Silicon M4 Pro)
  • Node: v25.8.0
  • Auth: claude.ai subscription (OAuth, not API key)
  • Regression window: Works in v2.1.78, broken in v2.1.83

Impact

This breaks all automation that uses -p mode for non-interactive scripting (Telegram bots, queue processors, CI/CD pipelines). Tokens are consumed and billed but the response text is silently discarded.

Notes

  • Interactive mode (without -p) works fine
  • --output-format json shows the metadata (tokens, cost, session_id) but result field is empty string
  • --bare mode also affected but additionally requires API key auth
  • Context-mode and other plugins/hooks do not affect the issue (tested with disabled plugins, empty MCP config, --disable-slash-commands)

View original on GitHub ↗

3 Comments

github-actions[bot] · 6 months ago

Found 1 possible duplicate issue:

  1. https://github.com/anthropics/claude-code/issues/38611

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

doobidoo · 6 months ago

Closing as duplicate of #38611. Our workaround: pin to v2.1.78 via npm install -g @anthropic-ai/claude-code@2.1.78. Added 👍 to the original.

github-actions[bot] · 6 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.