{"record":{"id":"54436470891281ed","repo":"mlflow/mlflow","slug":"failed-to-create-instructionsjudge-scorer-serial","errorCode":null,"errorMessage":"Failed to create InstructionsJudge scorer '{serialized.name}': {e}","messagePattern":"Failed to create InstructionsJudge scorer '(.+?)': (.+?)","errorType":"validation","errorClass":"MlflowException","httpStatus":null,"severity":"error","filePath":"mlflow/genai/scorers/base.py","lineNumber":539,"sourceCode":"            feedback_value_type = str  # default to str\n            if \"feedback_value_type\" in data and data[\"feedback_value_type\"] is not None:\n                feedback_value_type = InstructionsJudge._deserialize_feedback_value_type(\n                    data[\"feedback_value_type\"]\n                )\n\n            try:\n                return InstructionsJudge(\n                    name=serialized.name,\n                    description=serialized.description,\n                    instructions=data[\"instructions\"],\n                    model=data[\"model\"],\n                    feedback_value_type=feedback_value_type,\n                    generate_rationale_first=data.get(\"generate_rationale_first\", False),\n                    inference_params=data.get(\"inference_params\"),\n                    aggregations=serialized.aggregations,\n                )\n            except Exception as e:\n                raise MlflowException.invalid_parameter_value(\n                    f\"Failed to create InstructionsJudge scorer '{serialized.name}': {e}\"\n                )\n\n        # Handle MemoryAugmentedJudge scorers\n        elif serialized.memory_augmented_judge_data is not None:\n            from mlflow.genai.judges.optimizers.memalign.optimizer import MemoryAugmentedJudge\n\n            return MemoryAugmentedJudge._from_serialized(serialized)\n\n        elif serialized.third_party_scorer_data is not None:\n            data = serialized.third_party_scorer_data\n            module_path = data.get(\"module\") or \"\"\n            class_name = data.get(\"class\")\n            metric_name = data.get(\"metric_name\")\n            if not any(\n                module_path == m or module_path.startswith(m + \".\")\n                for m in THIRD_PARTY_SCORER_ALLOWED_MODULES\n            ):","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/genai/scorers/base.py#L521-L557","documentation":"After type-validating instructions_judge_data, MLflow reconstructs the live InstructionsJudge scorer by calling its constructor with the serialized fields. If the constructor itself throws (invalid inference_params combination, bad aggregation spec, incompatible feedback_value_type), the exception is wrapped in MlflowException.invalid_parameter_value with this message.","triggerScenarios":"Scorer.model_validate on data that passed type checks but fails InstructionsJudge creation — e.g. unsupported aggregation names, inference_params missing required model/uri entries, feedback_value_type not accepted by the judge implementation.","commonSituations":"Serialized on one MLflow version, deserialized on another where the constructor signature or validation changed; hand-tuned inference_params (e.g. wrong temperature type or missing target); custom aggregations not recognized at build time.","solutions":["Read the wrapped exception `{e}` for the concrete constructor failure and fix that field","Re-create the scorer in code (make_instructions_judge or equivalent) and re-serialize it with the current MLflow version","Validate inference_params against the model endpoint's accepted parameters","Pin/align MLflow versions between writer and reader of the serialized scorer"],"exampleFix":"// before\n{\"inference_params\": {\"temperature\": \"0.7\"}}\n// after\n{\"inference_params\": {\"temperature\": 0.7}}","handlingStrategy":"try-catch","validationCode":"ip = data.get(\"inference_params\", {})\nassert isinstance(ip, dict) and all(not isinstance(v, str) or v for v in ip.values())","typeGuard":"def has_buildable_judge_params(data: dict) -> bool:\n    ip = data.get(\"inference_params\")\n    return ip is None or (isinstance(ip, dict) and bool(ip))","tryCatchPattern":"try:\n    scorer = Scorer.model_validate(data)\nexcept MlflowException as e:\n    if \"Failed to create InstructionsJudge\" in str(e):\n        scorer = rebuild_instructions_judge(data, fallback_params={\"temperature\": 0})\n    else:\n        raise","preventionTips":["Test deserialization in CI with the same MLflow version used in production","Keep inference_params minimal and validated against the judge model endpoint","Pin MLflow versions across environments that share serialized scorers"],"tags":["mlflow","genai","deserialization","configuration"],"backgroundTag":"scorer-reconstruction-failed","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}