[BUG] AskUserQuestion answers occasionally produce empty text content block → API 400 "text content blocks must be non-empty"

Resolved 💬 4 comments Opened May 1, 2026 by nickgraynews Closed Jun 26, 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?

After answering an AskUserQuestion prompt, the next turn fails with an API 400 error: messages: text content blocks must be non-empty. Once it happens, the malformed user message stays in history and every subsequent turn fails with the same error until the conversation is cleared.

I use AskUserQuestion heavily and only hit this occasionally, so it isn't "every answer." The turn that triggered it for me had:

  • 4 questions answered in a single submission
  • A mix of preset-option picks and long free-text additions
  • At least one question where the answer was a preset option with no additional comment

My guess is that when Claude Code serializes the AskUserQuestion response into the next user message, at least one content block is being emitted as {"type":"text","text":""} instead of being omitted. The Anthropic API rejects any empty text block, so the whole request fails before reaching the model. Likely culprits: a per-question slot (option text vs. free-text comment) or a separator block between questions, ending up as "" instead of being dropped from the content array.

What Should Happen?

Empty option/comment slots should be omitted from the content array entirely, not serialized as empty text blocks. The next turn after AskUserQuestion should succeed regardless of which combination of preset options and free-text comments the user submits.

Error Messages/Logs

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages: text content blocks must be non-empty"},"request_id":"req_011CabiMZoSnbvjAA3fMH3bB"}


Request IDs from the failing session:

- `req_011CabiMZoSnbvjAA3fMH3bB`
- `req_011CabhpdM9bZKb5XVYfyw6D` (same session, follow-on failure on retry)

Retrying the turn doesn't help (the bad message is in history). `/clear` is the only fix.

Steps to Reproduce

Best guess — I haven't fully isolated which combination triggers it:

  1. Trigger an AskUserQuestion with multiple questions in one prompt (4 in my case).
  2. Answer them in one submission, mixing "pick a preset option, no extra comment" with "pick an option AND add free text."
  3. On the next turn, the API returns 400 with text content blocks must be non-empty.
  4. Any further messages in the conversation fail with the same error until /clear.

Workaround that seems to avoid it: add any character to every free-text field when answering, so no slot is empty.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

happens randomly

Claude Code Version

2.1.126

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Warp

Additional Information

_No response_

View original on GitHub ↗

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