{"record":{"id":"8522695bc8b08f3a","repo":"BerriAI/litellm","slug":"quality-tier-prefs-quality-tier-is-not-supported","errorCode":null,"errorMessage":"quality_tier={prefs.quality_tier} is not supported; valid tiers are {valid}","messagePattern":"quality_tier=(.+?) is not supported; valid tiers are (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/router_strategy/adaptive_router/bandit.py","lineNumber":55,"sourceCode":"        total: Final = self.alpha + self.beta\n        return self.alpha / total if total > 0 else 0.5\n\n    @property\n    def total_samples(self) -> int:\n        return max(0, int(self.alpha + self.beta - COLD_START_MASS))\n\n\ndef initial_cell(prefs: AdaptiveRouterPreferences, request_type: RequestType) -> BanditCell:\n    \"\"\"\n    Cold-start prior for a (model, request_type) cell.\n\n    mean = base_tier_weight[tier] + (STRENGTH_BONUS if request_type in strengths else 0)\n    capped at 0.95 to avoid an over-confident prior.\n    Total mass = COLD_START_MASS so that ~10 real observations can move it noticeably.\n    \"\"\"\n    if prefs.quality_tier not in BASE_TIER_WEIGHT:\n        valid: Final = sorted(BASE_TIER_WEIGHT)\n        raise ValueError(f\"quality_tier={prefs.quality_tier} is not supported; valid tiers are {valid}\")\n    base: Final = BASE_TIER_WEIGHT[prefs.quality_tier]\n    bonus: Final = STRENGTH_BONUS if request_type in prefs.strengths else 0.0\n    mean: Final = min(0.95, base + bonus)\n    alpha: Final = mean * COLD_START_MASS\n    beta: Final = (1.0 - mean) * COLD_START_MASS\n    return BanditCell(alpha=alpha, beta=beta)\n\n\ndef apply_delta(cell: BanditCell, delta_alpha: float, delta_beta: float) -> BanditCell:\n    \"\"\"\n    Apply a learning update to a cell, enforcing the sample cap.\n\n    SAMPLE_CAP is a HARD cap on (alpha + beta). When the cap would be exceeded,\n    we drop the update. (D5: hard cap, no rescaling — keep v0 simple.)\n    \"\"\"\n    new_alpha: Final = cell.alpha + delta_alpha\n    new_beta: Final = cell.beta + delta_beta\n    if new_alpha + new_beta > SAMPLE_CAP:","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/router_strategy/adaptive_router/bandit.py#L37-L73","documentation":"Config validation in the adaptive-router bandit priors: the requested quality_tier in AdaptiveRouterPreferences is not one of the valid tier values (listed in the message), so no base prior weight exists for it.","triggerScenarios":"Thrown at litellm/router_strategy/adaptive_router/bandit.py:55 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the listed valid quality tiers in routing preferences."],"exampleFix":null,"handlingStrategy":"validation","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"}