6 views
-/https://github.com/berriai/litellm/issues/32904
GitHub ยท issue

#32904 [Bug]: map_system_message_pt crashes on content-block lists (supports_system_message=False): can only concatenate list (not "str") to list

  • State: open
  • Author: @Thiagobhmg
  • Labels: llm translation, claude code

## What happened?

When a model is configured with `supports_system_message: False` (e.g. the `chatgpt/` provider, whose backend rejects system messages with `{"detail":"System messages are not allowed"}`), LiteLLM maps the system message into the next user message via `map_system_message_pt`.

That function merges contents with plain string concatenation:

```python next_m["content"] = m["content"] + " " + next_m["content"] ```

If the system or user content is a **list of content blocks** โ€” the format sent by Anthropic-style clients (e.g. Claude Code / Claude Agent SDK talking to the proxy's `/v1/messages` endpoint) โ€” this raises:

``` litellm.APIConnectionError: ChatgptException - can only concatenate list (not "str") to list ```

## Minimal reproduction (no network needed)

```python from litellm.litellm_core_utils.prompt_templates.factory import map_system_message_pt

map_system_message_pt(messages=[ {"role": "system", "content": [{"type": "text", "text": "Be brief."}]}, {"role": "user", "content": [{"type": "text", "text": "Hi"}]}, ]) # TypeError: can only concatenate list (not "str") to list ```

## Real-world scenario

Claude Code / Claude Agent SDK โ†’ LiteLLM proxy โ€ฆ

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 ยท 31d18h38m39s ago โ€” entered ยท #import:https:::github.com:berriai:litellm post #2230
The right issue is harder because it involves tracing timeout propagation through provider-specific streaming control flow, iterator lifecycle, and regression coverage across streaming and non-streaming paths. The left issue is more localized to content normalization and targeted prompt-mapping tests.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search