Skip to content

Interrupted thinking-only message causes 400 error (patch part bypasses filter) #9042

@grumpygordon

Description

@grumpygordon

Interrupting (Esc) while assistant is in thinking mode (reasoning only, no text output yet) breaks the session.

Next request fails with:

messages.X: all messages must have non-empty content except for the optional final assistant message

Related to #3101 but different root cause.

Repro:

  1. Use thinking model (claude-opus with high variant)
  2. Interrupt while "Thinking:" is displayed, before any text
  3. Send another message → 400 error

Cause:
message-v2.ts:toModelMessage() line 483:

msg.parts.some((part) => part.type !== "step-start" && part.type !== "reasoning")

Aborted messages should be skipped if they only have step-start/reasoning. But the patch part (created on abort) passes this check, so the message gets included with only reasoning content. Anthropic rejects non-final assistant messages with only reasoning.

Fix:
Add patch to exclusion, or check for output-producing parts (text, tool) explicitly.

  • macOS, dev build

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions