{"record":{"id":"3011dcf79e87395f","repo":"BerriAI/litellm","slug":"baseline-model-is-set-for-exactly-the-reverse-jobs","errorCode":null,"errorMessage":"baseline_model is set for exactly the reverse jobs","messagePattern":"baseline_model is set for exactly the reverse jobs","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/shadow_eval_logger.py","lineNumber":477,"sourceCode":"    id: str\n    router_name: str\n    direction: ShadowEvalDirection = \"forward\"\n    baseline_model: str | None = None\n    shadow_percentage: float\n    judge_model: str\n    max_turns: int\n    ends_at: datetime\n    attempts: int = 0\n\n    @field_validator(\"ends_at\")\n    @classmethod\n    def _as_utc(cls, value: datetime) -> datetime:\n        return value.replace(tzinfo=timezone.utc) if value.tzinfo is None else value\n\n    @model_validator(mode=\"after\")\n    def _baseline_model_matches_direction(self) -> \"ActiveShadowEvalJob\":\n        if (self.baseline_model is not None) != (self.direction == \"reverse\"):\n            raise ValueError(\"baseline_model is set for exactly the reverse jobs\")\n        return self\n\n    @property\n    def shadow_target(self) -> str:\n        \"\"\"The model the duplicated arm calls: the router itself for a forward job, the\n        fixed baseline for a reverse one. Total because the validator above pins\n        baseline_model to reverse jobs and only those.\"\"\"\n        return self.baseline_model or self.router_name\n\n\ndef _as_active_job(record: object, attempts: int) -> ActiveShadowEvalJob | None:\n    \"\"\"The sampling path's view of one job row, or None for a row it cannot sample: an\n    unknown direction, or a reverse job with no baseline model to duplicate against.\n    Failing closed here is what keeps the dispatch path total.\"\"\"\n    try:\n        job: Final = ActiveShadowEvalJob.model_validate(record)\n    except ValidationError as e:\n        verbose_logger.debug(\"shadow_eval: skipping unsamplable job row: %s\", e)","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/shadow_eval_logger.py#L459-L495","documentation":"Pydantic model validator on ActiveShadowEvalJob: baseline_model is set (or omitted) inconsistently with direction — a baseline model is only valid for 'reverse' shadow-eval jobs, so the job config is contradictory and rejected at load time.","triggerScenarios":"baseline_model configured on exactly the opposite set of shadow eval jobs than intended.","commonSituations":"Copy-pasted job config with baseline_model applied to the wrong job.","solutions":["Set baseline_model only for the intended shadow-eval job direction; remove it from the reverse job configuration."],"exampleFix":"# set baseline_model on both shadow jobs or neither","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-23T08:17:48.524Z"}