BerriAI/litellm · error · ValueError

classifier_llm_config is required when classifier_type is 'l

Error message

classifier_llm_config is required when classifier_type is 'llm'

What it means

Config validator on ComplexityRouterConfig: classifier_type is 'llm' but classifier_llm_config is None — an LLM classifier with no model/timeout config cannot run, so validation fails at load time.

Source

Thrown at litellm/router_strategy/complexity_router/config.py:633

            if isinstance(item, str):
                coerced[key] = item
            elif isinstance(item, (list, tuple)):
                coerced[key] = list(item)
            else:
                coerced[key] = item
        return coerced

    @field_validator("escalation_keywords")
    @classmethod
    def _normalize_escalation_keywords(cls, value: list[str] | None) -> list[str] | None:
        if value is None:
            return None
        return [stripped for keyword in value if (stripped := keyword.strip())]

    @model_validator(mode="after")
    def _validate_llm_classifier_config(self) -> "ComplexityRouterConfig":
        if self.classifier_type == "llm" and self.classifier_llm_config is None:
            raise ValueError("classifier_llm_config is required when classifier_type is 'llm'")
        return self

    @model_validator(mode="after")
    def _validate_adaptive_pools(self) -> "ComplexityRouterConfig":
        if not self.adaptive:
            return self
        normalized = {tier: (models if isinstance(models, list) else [models]) for tier, models in self.tiers.items()}
        if not any(normalized.values()):
            raise ValueError("adaptive=True requires at least one non-empty tier pool")
        empty: Final = [tier for tier, models in normalized.items() if not models]
        if empty:
            raise ValueError(f"adaptive=True tier pools must be non-empty; empty tiers: {empty}")
        self.tiers = normalized
        return self

    @model_validator(mode="after")
    def _validate_semantic_matching(self) -> "ComplexityRouterConfig":
        if not self.semantic_keyword_matching:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set classifier_llm_config when using classifier_type='llm'.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/router_strategy/complexity_router/config.py:633 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/0f5903890469d462. Report an issue: GitHub.