BerriAI/litellm · error · ValueError

Unsupported call_type=

Error message

Unsupported call_type={call_type!r} for compression. Expected one of: {sorted(_SUPPORTED_CALL_TYPES)}.

What it means

The prompt-compression normalizer only knows how to flatten messages for specific call types (e.g. completion-style chats); the call_type passed in is outside _SUPPORTED_CALL_TYPES, so messages cannot be scored for compression and the request is rejected.

Solutions

  1. Call compression only with a supported call_type from the list shown in the error.
  2. Check that you are routing a supported operation (e.g. completion) through the compression layer.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/compression/compress.py:110 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/70097ea4aec9f13a. Report an issue: GitHub.

Appendix: source

Thrown at litellm/compression/compress.py:110

            if item_type == "text":
                parts.append(str(item.get("text", "")))
            elif item_type == "tool_result":
                stack.append(item.get("content", ""))
    return " ".join(parts)


def _normalize_messages_for_compression(
    messages: list[dict],
    call_type: str,
) -> tuple[list[dict], list[dict]]:
    """
    Normalize each original message to a text-surrogate content for scoring.

    Returns:
        (normalized_messages, original_messages_copy)
    """
    if call_type not in _SUPPORTED_CALL_TYPES:
        raise ValueError(
            f"Unsupported call_type={call_type!r} for compression. Expected one of: {sorted(_SUPPORTED_CALL_TYPES)}."
        )

    original_messages: Final[list[dict[str, Any]]] = [dict(m) for m in messages]

    normalized_messages: Final[list[dict]] = []
    for msg in original_messages:
        normalized_messages.append(
            {
                **msg,
                "content": _content_to_text(msg.get("content", "")),
            }
        )
    return normalized_messages, original_messages


def _extract_last_user_message(messages: list[dict]) -> str:
    """Return the text content of the last user message."""

View on GitHub (pinned to 77b7c6c40c)