[BUG] v2.1.83: Headless mode (-p) returns empty result despite output tokens consumed

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

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code v2.1.83 headless/print mode (-p) returns an empty result field
despite output tokens being consumed. This is a regression from v2.1.81 which
works correctly.

What Should Happen?

The JSON output shows output_tokens: 13 and stop_reason: "end_turn", confirming
the model generates a response, but the result field is empty.

Error Messages/Logs

Tested with:
  - Multiple models (opus, sonnet) — all empty
  - --system-prompt override — still empty
  - --allowedTools "" — still empty
  - --permission-mode bypassPermissions — still empty
  - --output-format text — also empty
  - --output-format stream-json — no output at all

This breaks any automation that uses claude -p for headless invocations
  (scheduled tasks, CI pipelines, scripts). Our scheduled daily digest broke
  silently — Claude "completed successfully" (exit code 0) but returned nothing.

Steps to Reproduce

claude -p "Say hello" --output-format json

Expected: "result": "Hello! How can I help you today?"
Actual: "result": ""

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.81 (installed 2025-03-21)

Claude Code Version

2.1.83 (auto-updated 2025-03-25)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Rolling back the symlink to v2.1.81 immediately resolves the issue.

View original on GitHub ↗

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