[Bug] `--print` flag returns empty output in version 2.1.83

Status Fixed / completed
Reported on v2.1.83
Maintainer reply ✓ Yes — ashwin-ant
Activity 4 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 --print "say hello" returns empty. Exit code 0, no debug output. New behavior in 2.1.83, not present in 2.1.81.

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 2.1.83
  • Feedback ID: 80d8902f-a921-4323-820e-3881bf747ef3

Errors

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/jxstanford/.local/share/claude/versions/2.1.83 (expected in multi-process scenarios)\n    at ibT (/$bunfs/root/src/entrypoints/cli.js:2735:2168)\n    at Zcq (/$bunfs/root/src/entrypoints/cli.js:2735:1326)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-03-25T15:53:37.037Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server github invalid: Missing environment variables: GITHUB_PERSONAL_ACCESS_TOKEN\n    at R5_ (/$bunfs/root/src/entrypoints/cli.js:2572:23131)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-03-25T15:53:37.071Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server github invalid: Missing environment variables: GITHUB_PERSONAL_ACCESS_TOKEN\n    at R5_ (/$bunfs/root/src/entrypoints/cli.js:2572:23131)\n    at async h (/$bunfs/root/src/entrypoints/cli.js:5206:10692)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-03-25T15:53:41.722Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server github invalid: Missing environment variables: GITHUB_PERSONAL_ACCESS_TOKEN\n    at R5_ (/$bunfs/root/src/entrypoints/cli.js:2572:23131)\n    at async W (/$bunfs/root/src/entrypoints/cli.js:5206:9922)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-03-25T15:53:41.722Z"},{"error":"Error: {\"message\":\"14 UNAVAILABLE: No connection established. Last error: Error: connect ECONNREFUSED 127.0.0.1:4317. Resolution note: \",\"code\":\"14\",\"details\":\"No connection established. Last error: Error: connect ECONNREFUSED 127.0.0.1:4317. Resolution note: \",\"metadata\":\"[object Object]\",\"originalLine\":\"2683\",\"originalColumn\":\"33\",\"line\":\"2683\",\"column\":\"33\",\"sourceURL\":\"/$bunfs/root/src/entrypoints/cli.js\",\"stack\":\"Error: 14 UNAVAILABLE: No connection established. Last error: Error: connect ECONNREFUSED 127.0.0.1:4317. Resolution note: \\n    at KP$ (/$bunfs/root/src/entrypoints/cli.js:2681:80570)\\n    at onReceiveStatus (/$bunfs/root/src/entrypoints/cli.js:2685:2719)\\n    at onReceiveStatus (/$bunfs/root/src/entrypoints/cli.js:2683:9828)\\n    at onReceiveStatus (/$bunfs/root/src/entrypoints/cli.js:2683:9163)\\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:2699:23910)\\n    at processTicksAndRejections (native:7:39)\\nfor call at\\n    at makeUnaryRequest (/$bunfs/root/src/entrypoints/cli.js:2685:2240)\\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:2685:7187)\\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:2701:118030)\\n    at Promise (unknown:1:11)\\n    at send (/$bunfs/root/src/entrypoints/cli.js:2701:117899)\\n    at export (/$bunfs/root/src/entrypoints/cli.js:2661:33516)\\n    at export (/$bunfs/root/src/entrypoints/cli.js:2661:30111)\\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:138:158495)\\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:138:158435)\\n    at Promise (unknown:1:11)\",\"name\":\"Error\"}\n    at error (/$bunfs/root/src/entrypoints/cli.js:2681:27375)\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:138:85511)\n    at mP4 (/$bunfs/root/src/entrypoints/cli.js:138:86055)\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:139:17366)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-03-25T15:53:46.730Z"},{"error":"Error: {\"message\":\"14 UNAVAILABLE: No connection established. Last error: Error: connect ECONNREFUSED ::1:4317. Resolution note: \",\"code\":\"14\",\"details\":\"No connection established. Last error: Error: connect ECONNREFUSED ::1:4317. Resolution note: \",\"metadata\":\"[object Object]\",\"originalLine\":\"2683\",\"originalColumn\":\"33\",\"line\":\"2683\",\"column\":\"33\",\"sourceURL\":\"/$bunfs/root/src/entrypoints/cli.js\",\"stack\":\"Error: 14 UNAVAILABLE: No connection established. Last error: Error: connect ECONNREFUSED ::1:4317. Resolution note: \\n    at KP$ (/$bunfs/root/src/entrypoints/cli.js:2681:80570)\\n    at onReceiveStatus (/$bunfs/root/src/entrypoints/cli.js:2685:2719)\\n    at onReceiveStatus (/$bunfs/root/src/entrypoints/cli.js:2683:9828)\\n    at onReceiveStatus (/$bunfs/root/src/entrypoints/cli.js:2683:9163)\\n    at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:2699:23910)\\n    at processTicksAndRejections (native:7:39)\\nfor call at\\n    at makeUnaryRequest (/$bunfs…

Note: Content was truncated.

View original on GitHub ↗

4 Comments

WhiteaChen · 5 months ago

{"type":"result","subtype":"success","is_error":true,"duration_ms":25,"duration_api_ms":0,"num_turns":1,"result":"Not logged in · Please run /login","stop_reason":"stop_sequence","session_id":"9e6bbe64-2d5e-4b9b-a728-f01a16a03eb9","total_cost_usd":0,"usage":{"input_tokens":0,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":0,"server_tool_use":{"web_search_requests":0,"web_fetch_requests":0},"service_tier":"standard","cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"inference_geo":"","iterations":[],"speed":"standard"},"modelUsage":{},"permission_denials":[],"fast_mode_state":"off","uuid":"c2c551a9-9480-43f1-82ef-938a758fd641"}

logged in but still output this error,hope this msg will helpful,I used to --bare -p ,now it may be skip login check. if not used --bare also return nothing but not output logged in error

In Windows 11 PowerShell

yurukusa · 5 months ago

Same root cause as #38651, #38667, and #38611 — Stop hooks cause empty --print/-p output.
Check if you have Stop hooks configured:

jq ".hooks.Stop" ~/.claude/settings.json 2>/dev/null

If yes, wrap them with a headless detector:

[ "$CC_HEADLESS" = "1" ] && exit 0
PARENT=$(ps -o args= -p $PPID 2>/dev/null || true)
echo "$PARENT" | grep -qE "\bclaude\b.*\s-p\b" && exit 0

Or use a wrapper script:

export CC_HEADLESS=1
claude --print "$@"

If you do NOT have Stop hooks, this is a separate -p mode regression in v2.1.83. The argument-based form claude -p "prompt" may work when the stdin-pipe form echo "prompt" | claude -p does not.

ashwin-ant collaborator · 4 months ago

This was fixed in v2.1.84 — Fixed claude -p returning empty result when Stop hooks (or other progress/attachment-emitting sources) are configured — result extraction now skips trailing progress/attachment messages to find the actual assistant response. If you're still seeing this in the latest version, please comment with your version and repro and we'll reopen.

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