claude -p produces empty output despite model responding (v2.1.83)

Status Fixed / completed
Reported on v2.1.83
Maintainer reply ✓ Yes — ashwin-ant
Activity 3 comments · opened Mar 25, 2026 · closed Apr 19, 2026
💡 Likely answer: A maintainer (ashwin-ant, collaborator) responded on this thread — see the highlighted reply below.

Bug Description

claude -p (print/non-interactive mode) produces no output. The model responds correctly (visible in streaming output), but the final result field is empty, so nothing gets printed to stdout.

Steps to Reproduce

claude -p "say hello"
# No output, exit code 0

claude -p "say hello" --output-format json
# result field is empty: "result":""

Expected Behavior

The model's response should be printed to stdout.

Actual Behavior

No output. Exit code 0. The JSON output shows "result":"" with 13 output tokens consumed.

Diagnosis

Using --output-format stream-json --verbose reveals the model IS responding:

{"type":"assistant","message":{"content":[{"type":"text","text":"\n\nHello! How can I help you today?"}]}}

But the final result object has an empty result field:

{"type":"result","subtype":"success","is_error":false,"result":"","stop_reason":"end_turn",...}

The response exists in the stream but is not captured into the result field.

Additional details

  • Tested with both Opus and Sonnet, same behavior
  • Tested from different directories (~/.claude, /tmp), same behavior
  • Tested with --output-format text and --output-format json, same behavior
  • Exit code is always 0

Environment

  • Claude Code version: 2.1.83 (latest as of 2026-03-26)
  • Platform: macOS (Darwin 24.6.0)
  • Shell: zsh
  • Plugins installed: oh-my-claude-sisyphus, frontend-design, claude-notifications-go (disabled)

View original on GitHub ↗

3 Comments

BrunoZirnstein · 6 months ago

+1 here

ashwin-ant collaborator · 5 months ago

This was fixed in v2.1.84 — Print mode now skips Stop-hook progress/attachment messages when locating the final assistant response, so claude -p output is no longer blank when a Stop hook is configured. If you're still seeing this in the latest version, please comment with your version and repro and we'll reopen.

github-actions[bot] · 5 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.