BerriAI/litellm · error · ProxyException

validation_error

validation_error

Error message

complexity_router_config is invalid at {location}: {first.get('msg', 'invalid value')}. The router would drop this deployment at load time, so the write is rejected instead.

What it means

Error "complexity_router_config is invalid at {location}: {first.get('msg', 'invalid value')}. The router would drop this deployment at load time, so the write is rejected instead." thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/management_endpoints/model_management_endpoints.py:237

    if incoming_params.model is None:
        return None
    present_fields: Final = frozenset(
        field
        for field in STRATEGY_ROUTER_PARAM_FIELDS
        for source in (incoming_params, existing_params)
        if source is not None and getattr(source, field, None) is not None
    )
    return validate_strategy_router_model_write(model=incoming_params.model, present_fields=present_fields)


def _raise_on_strategy_router_write_violation(
    incoming_params: GenericLiteLLMParams | None,
    existing_params: GenericLiteLLMParams | None,
) -> None:
    violation = _strategy_router_write_violation(incoming_params=incoming_params, existing_params=existing_params)
    if violation is None:
        return
    raise ProxyException(
        message=violation,
        type=ProxyErrorTypes.validation_error.value,
        code=status.HTTP_400_BAD_REQUEST,
        param="litellm_params.model",
    )


_PTU_MODEL_INFO_FIELDS: Final = ("ptu_count", "cost_per_ptu_per_hour", "ptu_effective_from", "ptu_effective_to")
_PTU_PRICED_PAIR: Final = frozenset({"ptu_count", "cost_per_ptu_per_hour"})


def _explicitly_cleared_ptu_fields(model_info: ModelInfo | None) -> frozenset[str]:
    """The PTU fields a patch sends as an explicit null, which update_db_model drops.

    Empty while the feature is off, so disabling pauses PTU rather than letting a client
    that round-trips a model_info blob erase a configuration set up during an earlier opt-in.
    """
    if model_info is None or not is_ptu_cost_attribution_enabled():

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Fix the complexity_router_config value at the indicated location per the validation message.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/model_management_endpoints.py:237 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/16ce8d8ab5dde3e2. Report an issue: GitHub.