Bug: --print mode returns empty result in v2.1.83 (model responds but output is discarded)

Resolved 💬 3 comments Opened Mar 25, 2026 by mvillmow Closed Mar 29, 2026

Bug Description

claude --print (or -p) returns empty stdout in v2.1.83. The model successfully generates tokens (confirmed via --output-format stream-json --verbose), but the result field in the final output is always "", producing only a single newline on stdout.

This is a regression — the same invocations worked in earlier versions.

Reproduction

# 1. JSON output shows result="" but output_tokens > 0
claude -p "Say hello" --model claude-haiku-4-5 --output-format json < /dev/null
# → {"result":"", "output_tokens":7, "total_cost_usd":0.02, ...}

# 2. Text output is just a single newline (1 byte)
echo "Say hello" | claude -p --model claude-haiku-4-5
# → (single newline character)

# 3. Stream-JSON proves the model IS responding — content visible in assistant events
claude -p "Say hello" --model claude-haiku-4-5 --output-format stream-json --verbose < /dev/null
# → {"type":"assistant","message":{"content":[{"type":"text","text":"Hello! 👋 ..."}]}}
# → {"type":"result","result":""}  ← result field is EMPTY

All three invocations charge API tokens and show output_tokens > 0, but the result field (used for stdout in text mode) is always empty.

Tested Variants (all produce empty result)

| Flag Combination | Result |
|------------------|--------|
| -p "prompt" (positional arg) | Empty |
| echo "prompt" \| claude -p (stdin) | Empty |
| --output-format text | Single newline |
| --output-format json | "result": "" |
| --dangerously-skip-permissions | Empty |
| --allowedTools "" | Empty |
| --system-prompt-file path | Empty |
| Different models (opus, sonnet, haiku) | All empty |
| With/without env -u CLAUDECODE | Empty |

Expected Behavior

result field should contain the model's response text. --output-format text should write the response to stdout.

Actual Behavior

result is always "". Stdout in text mode contains only \n (0x0a).

Environment

  • Claude Code version: 2.1.83
  • Platform: Linux (WSL2) — Linux 6.6.87.2-microsoft-standard-WSL2
  • Shell: bash

Impact

Any automated workflow that shells out to claude --print and reads stdout gets no content. This breaks:

  • Automated LLM judge evaluation pipelines
  • CI/CD scripts that invoke Claude
  • Any subprocess-based Claude invocation

The model responds correctly (tokens generated, cost charged), but the output is silently discarded before reaching the caller.

View original on GitHub ↗

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