spacedriveapp / spacedriveapp/spacebot
Channel hangs with 400 'text content blocks must be non-empty' when skip is called in same turn as branch tool
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.4k
- Forks
- 367
- PR merge metrics
- No merged PRs in 30d
Description
Description
When the Channel LLM calls the branch tool and the skip tool in the same turn (while waiting for the branch result), the resulting assistant message in conversation history contains an empty text content block. Every subsequent Anthropic API call using that history then fails permanently with:
Anthropic API error (400 Bad Request): messages: text content blocks must be non-empty
The channel becomes completely unresponsive — all new user messages fail instantly with the same error.
Reproduction Steps
- Send a message that causes the Channel to spawn a branch and call
skipin the same turn (e.g. ask for a system status check) - The branch completes and a retrigger fires
- The retrigger API call fails with 400
- All subsequent messages to the same channel fail with 400
From the logs, the exact sequence is:
branch spawned → branch tool call recorded in assistant turn
skip tool called → skip recorded in same assistant turn (empty text block created)
branch completes → retrigger fires
→ ERROR: Anthropic API error (400 Bad Request): messages: text content blocks must be non-empty
Root Cause
The Anthropic API requires that if a text content block is present in an assistant message, it must be non-empty. When skip is used alongside a branch tool call in the same turn, the message serialization produces an assistant message with an empty text block followed by tool_use blocks. This violates the API constraint.
The likely fix is to strip empty text content blocks from assistant messages before sending to the Anthropic API, or ensure the serialization never produces them.
Impact
- Channel is permanently stuck until conversation history is manually cleared and the daemon restarted
- Recovery requires:
DELETE FROM conversation_messages WHERE channel_id = '<id>';+spacebot restart
Environment
- Spacebot v0.2.0
- Channel model:
anthropic/claude-haiku-4-5 - Platform: Telegram
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the branch-and-skip sequence and tracing assistant-message serialization through the Anthropic API call. No source file or test is named in the issue, so locate where the assistant history is serialized and verify that the retrigger and later messages no longer contain empty text content blocks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- ai, backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100