Skip to content

Bug: Provider returns 400 due to empty text content blocks in messages #770

@s6yoho

Description

@s6yoho

Bug Description

When using a channel, the provider returns a 400 error because the messages array contains empty text content blocks.

Error Message

Provider any returned 400: Provider returned 400: Bad Request | Upstream: {"error":{"type":"new_api_error","message":"messages: text content blocks must be non-empty (request id: 20260211215402599063580RdzKE8eI) (request id: 20260211215350819939941BGRT2UD6)"},"type":"error"}

Root Cause

The assistant message contains an empty text content block ("text": ""). This happens when the model response includes thinking + tool_use but the text portion is empty. Claude Code Hub should filter out or skip empty text content blocks before forwarding the request upstream.

Example problematic message:

{
  "role": "assistant",
  "content": [
    {
      "type": "thinking",
      "thinking": "...",
      "signature": ""
    },
    {
      "type": "text",
      "text": ""
    },
    {
      "type": "tool_use",
      "id": "tooluse_oiIL11PVOn3Rv1A9WckX00",
      "name": "Skill",
      "input": {
        "skill": "api-relay-tester",
        "args": "..."
      }
    }
  ]
}

The {"type": "text", "text": ""} block is the problem - the Anthropic API rejects empty text content blocks.

Expected Behavior

Claude Code Hub should strip empty text content blocks (where text is an empty string) from messages before forwarding them to the upstream provider.

Environment

  • Claude Code Hub version: v0.5.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions