{"record":{"id":"2488737d37433342","repo":"BerriAI/litellm","slug":"no-candidate-models-left-for-tier-tier-key-after","errorCode":null,"errorMessage":"No candidate models left for tier {tier_key} after routing-plugin filtering","messagePattern":"No candidate models left for tier (.+?) after routing-plugin filtering","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/router_strategy/complexity_router/complexity_router.py","lineNumber":1216,"sourceCode":"            # plugin-filtering error below and send the operator hunting for a policy\n            # plugin that never ran, so name the real problem: the tier has no models.\n            raise ValueError(f\"No models configured for tier {tier_key}\")\n        context = RoutingContext(\n            raw_messages=raw_messages or [],\n            structured_messages=resolved_messages or [],\n            candidate_models=list(pool),\n            metadata=request_kwargs.get(metadata_key) or {},\n        )\n        for plugin in self.config.plugins:\n            context = await plugin.run(context)\n\n        if not context.candidate_models:\n            # A plugin narrowing a tier to zero candidates is a policy decision (e.g. no\n            # model this tenant's budget allows) -- falling back to default_model here\n            # (which was never checked against the plugins) would let that policy be\n            # silently bypassed. Raise instead, matching the Router-level plugin\n            # pipeline's own fail-closed behavior for the same situation.\n            raise ValueError(f\"No candidate models left for tier {tier_key} after routing-plugin filtering\")\n        return self._pick_from_tier_value(context.candidate_models, tier_key)\n\n    def _ensure_adaptive_router(self) -> Any | None:\n        if not self.config.adaptive:\n            return None\n        if self.adaptive_router is not None:\n            return self.adaptive_router\n        if self._adaptive_init_attempted:\n            return self.adaptive_router\n        self._adaptive_init_attempted = True\n\n        from litellm.router_strategy.adaptive_router.adaptive_router import (\n            AdaptiveRouter,\n        )\n        from litellm.router_strategy.adaptive_router.config import (\n            ADAPTIVE_ROUTER_CHOSEN_MODEL_KEY,\n        )\n        from litellm.types.router import (","sourceCodeStart":1198,"sourceCodeEnd":1234,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/router_strategy/complexity_router/complexity_router.py#L1198-L1234","documentation":"Routing guard in the complexity router's plugin flow: the tier's model pool existed, but after all routing plugins ran, the candidate model list was empty — a plugin filtered out every candidate for this request.","triggerScenarios":"Thrown at litellm/router_strategy/complexity_router/complexity_router.py:1216 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Loosen routing-plugin filters or add models for the tier that pass the filters."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}