BerriAI/litellm · error · ValueError

LLM classifier returned empty content

Error message

LLM classifier returned empty content

What it means

Result guard in the complexity router's LLM classifier: the completion succeeded but choices[0].message.content is empty, so there is no tier text to parse; typically a filtered/refused response or a misconfigured model.

Source

Thrown at litellm/router_strategy/complexity_router/complexity_router.py:1077

                "model": llm_config.model,
                "messages": messages_for_call,
                "response_format": response_format,
            }
        }

        response: Final[ModelResponse] = await self.litellm_router_instance.acompletion(
            model=llm_config.model,
            messages=messages_for_call,
            response_format=response_format,
            timeout=llm_config.timeout_ms / 1000,
            metadata=metadata,
            proxy_server_request=proxy_server_request,
            turn_off_message_logging=turn_off_message_logging,
            **_parent_session_kwargs(request_kwargs),
        )
        content: Final = response.choices[0].message.content
        if not content:
            raise ValueError("LLM classifier returned empty content")
        raw_tier: Final = _LabeledTierClassification.model_validate_json(content).tier
        tier: Final = self.config.tier_for_label(raw_tier)
        if tier is None:
            raise ValueError(f"LLM classifier returned an unrecognized tier: {raw_tier!r}")
        return tier, _response_cost_or_none(response)

    @staticmethod
    def _build_classifier_user_payload(
        prompt: str,
        system_prompt: str | None = None,
        prior_turns: Sequence[tuple[str, str]] | None = None,
        messages: Sequence[Mapping[str, object]] | None = None,
        has_prior_conversation: bool = False,
        label_roles: bool = False,
    ) -> str:
        """Build the classifier's user message: caller constraints, prior turns, depth, current ask.

        Everything here is caller-controlled, which is why none of it is interpolated into the system

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Retry; check the classifier model config and prompt so it returns a tier label.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/router_strategy/complexity_router/complexity_router.py:1077 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/08622eea25bf4065. Report an issue: GitHub.