[BUG] CLI returns empty responses: Model generates <thinking> block but output_tokens is 0 (Opus 4.7 & Sonnet 4.6)

Resolved 💬 4 comments Opened Apr 22, 2026 by ns-ctw Closed Jun 8, 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?

When interacting with the CLI, the AI occasionally gets stuck in a state where it processes the user's prompt and generates a lengthy <thinking> block, but completely fails to generate any visible output or tool calls. The response terminates with output_tokens: 0.

From the user's perspective, the CLI appears to be interrupted, frozen, or silently ignoring the prompt, leading to a highly frustrating experience.

What Should Happen?

If the model uses a tool, it should output mandatory explanatory text alongside the tool call to ensure the UI/CLI renders it correctly.

The system should never silently fail with output_tokens: 0 after a successful <thinking> phase. There should be an error catch or a fallback mechanism to inform the user what went wrong, rather than displaying an empty prompt.

Error Messages/Logs

{
  "type": "assistant",
  "uuid": "[REDACTED_UUID]",
  "timestamp": "2026-04-22T08:11:50.266Z",
  "entrypoint": "cli",
  "cwd": "/Users/[REDACTED_USER]/Workdir/[REDACTED_PROJECT_PATH]",
  "version": "2.1.117",
  "message": {
    "model": "claude-opus-4-7",
    "id": "msg_bdrk_[REDACTED_ID]",
    "type": "message",
    "role": "assistant",
    "content": [
      {
        "type": "thinking",
        "thinking": "[REDACTED_LONG_THINKING_PROCESS]",
        "signature": "[REDACTED_SIGNATURE]"
      }
    ],
    "stop_reason": null,
    "stop_sequence": null,
    "stop_details": null,
    "usage": {
      "input_tokens": 6,
      "cache_creation_input_tokens": 36412,
      "cache_read_input_tokens": 10477,
      "output_tokens": 0,
      "service_tier": "standard"
    }
  }
}

{
  "type": "assistant",
  "uuid": "[REDACTED_UUID]",
  "timestamp": "2026-04-22T08:15:12.705Z",
  "entrypoint": "cli",
  "cwd": "/Users/[REDACTED_USER]/Workdir/[REDACTED_PROJECT_PATH]",
  "version": "2.1.117",
  "message": {
    "model": "claude-sonnet-4-6",
    "id": "msg_bdrk_[REDACTED_ID]",
    "type": "message",
    "role": "assistant",
    "content": [
      {
        "type": "thinking",
        "thinking": "The user is frustrated because my responses keep getting cut off/interrupted... Looking back at the conversation, I can see several instances where my response shows \"(no content)\" - this means my response was empty/cut off... I should always include text alongside tool calls, and the instruction is clear that I need to state what I'm about to do before invoking anything... I was sending entirely tool-focused responses without any accompanying text, which would appear as silence to the user...",
        "signature": "[REDACTED_SIGNATURE]"
      }
    ],
    "stop_reason": null,
    "stop_sequence": null,
    "usage": {
      "input_tokens": 3,
      "cache_creation_input_tokens": 35117,
      "cache_read_input_tokens": 0,
      "output_tokens": 0
    }
  }
}

Steps to Reproduce

  1. The user interacts with the CLI normally (e.g., analyzing a Confluence document).
  2. The user asks a follow-up question.
  3. The model processes the request and enters the <thinking> phase.
  4. The generation ends abruptly without producing any text output.

Claude Model

Not sure / Multiple models

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.117

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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