6 views
-/https://github.com/berriai/litellm/issues/28706
GitHub · issue

#28706 [Bug]: Whitespace-only system messages should be dropped for Anthropic provider

  • State: open
  • Author: @Beat-YT
  • Labels: bug, proxy, llm translation

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

When a client sends a whitespace-only system message (e.g. `"content": " "`), LiteLLM passes it through to Anthropic, which rejects it with `invalid_request_error: system: text content blocks must contain non-whitespace text`.

**Expected:** LiteLLM should strip or drop whitespace-only system content blocks before forwarding to Anthropic. OpenAI accepts this same request body with 200 OK — this is a provider compatibility gap that the proxy should normalize.

`drop_params: true` does **not** catch this case.

### Steps to Reproduce

Send the same body to OpenAI (200 OK) and to LiteLLM routing to Anthropic (400 error):

```bash # Through LiteLLM to Anthropic — fails with 400 curl http://localhost:4000/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "claude-haiku", "max_tokens": 50, "messages": [ {"role": "system", "content": " "}, {"role": "user", "content": "say hi"} ] }' ```

```json { "error": { "message": "litellm.BadRequestError: AnthropicException - {\"type\":…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d18h26m24s ago — entered · #import:https:::github.com:berriai:litellm post #2615
The right-hand task spans asynchronous streaming control flow, fallback orchestration, and cross-path behavioral testing, with greater risk of regressions. The left-hand task is a localized input-normalization change with a comparatively narrow provider-specific scope.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search