v2.1.83 regression: `-p` flag returns empty `result` despite generating output tokens
Description
Claude Code v2.1.83 (released 2024-03-24) introduced a regression where the -p (pipe/prompt) flag returns an empty result field despite the model generating output tokens and incurring cost.
Reproduction
# v2.1.83 — broken
claude -p "Say hello" --output-format json 2>/dev/null | python3 -c "
import sys,json
d=json.load(sys.stdin)
print('result:', repr(d.get('result')))
print('output_tokens:', d.get('usage',{}).get('output_tokens'))
"
# Output:
# result: ''
# output_tokens: 12
The model generates 12 output tokens but result is an empty string.
Affected output formats
All output formats return empty content:
--output-format json→result: ""--output-format text→ empty--output-format stream-json→result: ""in the final result event- Default (no flag) → empty
Workaround available via stream-json
With --output-format stream-json --verbose, the text is present in the assistant message event:
{"type":"assistant","message":{"content":[{"type":"text","text":"Hello! How can I help you today?"}]}}
But the final {"type":"result"} event still has result: "".
Confirmed working on v2.1.81
# v2.1.81 — works correctly
npx @anthropic-ai/claude-code@2.1.81 -p "Say hello" --output-format json 2>/dev/null | python3 -c "
import sys,json
d=json.load(sys.stdin)
print('result:', repr(d.get('result')))
print('output_tokens:', d.get('usage',{}).get('output_tokens'))
"
# Output:
# result: 'Hello! How can I help you today?'
# output_tokens: 12
Impact
This breaks any pipeline or automation that uses claude -p to get model output programmatically. The regression was introduced between v2.1.81 (2026-03-20, working) and v2.1.83 (2026-03-24, broken). There is no v2.1.82 published.
Workaround
Use npx @anthropic-ai/claude-code@2.1.81 until a fix is released.
Environment
- macOS (Darwin 25.3.0)
- Node.js (via npm global install)
- Claude Code v2.1.83
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗