Skip to content

Anthropic: leave out an empty plain message - #30

Merged
ayman3000 merged 1 commit into
mainfrom
drop-empty-plain-messages
Nov 1, 2026
Merged

ayman3000 merged 1 commit into
mainfrom
drop-empty-plain-messages

Conversation

@ayman3000

Copy link
Copy Markdown
Owner

SwiftAgentKit's retry after a timed-out think appends an empty assistant turn (Agent.swift: conversation.append(.assistant(""))). The Anthropic body sent it as "content": "", which the Messages API refuses. Plain messages with empty content are now left out; the user turns on either side merge (existing mergingConsecutiveRoles). Test: anEmptyPlainAssistantTurnIsLeftOut. 191 tests pass.

🤖 Generated with Claude Code

…ntent)

The agent's retry after a timed-out think appends an empty assistant turn;
sent as "content": "" it is a 400. Left out, the user turns around it merge.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ayman3000
ayman3000 merged commit 6bc0260 into main Nov 1, 2026
@ayman3000
ayman3000 deleted the drop-empty-plain-messages branch November 1, 2026 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant