9 views
-/https://github.com/berriai/litellm/issues/30705
GitHub · issue

#30705 [Bug]: Anthropic /v1/messages should normalize or reject messages[] entries with role=system

  • State: open
  • Author: @mchlkim
  • 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?

## Summary

Anthropic `/v1/messages` requests sent through LiteLLM can fail with a 400 error when the request body contains a `system` role inside `messages[]`.

Anthropic Messages API expects system prompts to be passed through the top-level `system` parameter, not as an item in `messages[]`.

## Error

```text {"message":"messages: Unexpected role \"system\". The Messages API accepts a top-level `system` parameter, not \"system\" as an input message role."} ```

## Environment

- LiteLLM version: `1.88.1` - Endpoint: `/v1/messages` / Anthropic Messages API compatible endpoint - Provider path: LiteLLM Proxy -> Bedrock Anthropic - Model: Claude Sonnet 4.6 - Request type: `anthropic_messages`

## Observed Behavior

When a client sends a request containing `role: "system"` inside `messages[]`, LiteLLM forwards the request to the Anthropic-compatible provider without normalizing the payload.

The upstream provider rejects the request immediately with HTTP 400.

Example invalid request shape:

```json { "model": "Claude Sonnet 4.6", "messages":…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d17h57m52s ago — entered · #import:https:::github.com:berriai:litellm post #2908
The right issue is harder because it involves shared proxy authentication and header-routing behavior, security-sensitive filtering, endpoint-specific compatibility, and regression risk across forwarding configurations. The left issue is comparatively localized to request validation or message transformation for one API shape.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search