{"record":{"id":"e1d0a1368ec36e19","repo":"mlflow/mlflow","slug":"invalid-parameter-value-e1d0a1","errorCode":"INVALID_PARAMETER_VALUE","errorMessage":"Unrecognized serialization format: {serialization_format}. Please specify one of the following supported formats: {SUPPORTED_SERIALIZATION_FORMATS}.","messagePattern":"Unrecognized serialization format: (.+?)\\. Please specify one of the following supported formats: (.+?)\\.","errorType":"error_code","errorClass":"MlflowException","httpStatus":null,"severity":"error","filePath":"mlflow/sklearn/__init__.py","lineNumber":261,"sourceCode":"            sk_path_dir_1,\n            serialization_format=mlflow.sklearn.SERIALIZATION_FORMAT_CLOUDPICKLE,\n        )\n\n        # save the model in pickle format\n        # set path to location for persistence\n        sk_path_dir_2 = ...\n        mlflow.sklearn.save_model(\n            sk_model,\n            sk_path_dir_2,\n            serialization_format=mlflow.sklearn.SERIALIZATION_FORMAT_PICKLE,\n        )\n    \"\"\"\n    import sklearn\n\n    _validate_env_arguments(conda_env, pip_requirements, extra_pip_requirements)\n\n    if serialization_format not in SUPPORTED_SERIALIZATION_FORMATS:\n        raise MlflowException(\n            message=(\n                f\"Unrecognized serialization format: {serialization_format}. Please specify one\"\n                f\" of the following supported formats: {SUPPORTED_SERIALIZATION_FORMATS}.\"\n            ),\n            error_code=INVALID_PARAMETER_VALUE,\n        )\n\n    if serialization_format != SERIALIZATION_FORMAT_SKOPS and not is_in_databricks_runtime():\n        _logger.warning(\n            \"Saving scikit-learn models in the pickle or cloudpickle format requires exercising \"\n            \"caution because these formats rely on Python's object serialization mechanism, \"\n            \"which can execute arbitrary code during deserialization. \"\n            \"The recommended safe alternative is the 'skops' format. \"\n            \"For more information, see: https://scikit-learn.org/stable/model_persistence.html\",\n        )\n\n    _validate_and_prepare_target_save_path(path)\n    code_path_subdir = _validate_and_copy_code_paths(code_paths, path)","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/sklearn/__init__.py#L243-L279","documentation":"mlflow.sklearn.save_model validates the serialization_format parameter against SUPPORTED_SERIALIZATION_FORMATS (['skops', 'pickle', 'cloudpickle']). Passing anything else is rejected with INVALID_PARAMETER_VALUE before any model is written.","triggerScenarios":"Calling mlflow.sklearn.save_model(sk_model, path, serialization_format='joblib') or any misspelled/unsupported format string.","commonSituations":"Confusing joblib with MLflow's supported formats; typos like 'pkl' or 'cloud_pickle'; copying code from older examples using formats MLflow never supported.","solutions":["Use one of: 'skops' (recommended, safer), 'pickle', or 'cloudpickle' — or omit the parameter to use the default ('pickle').","Fix typos in the format string (exact match, lowercase).","If you need joblib serialization, use joblib directly outside MLflow or keep the model as pickle via MLflow.","Check mlflow.sklearn.SUPPORTED_SERIALIZATION_FORMATS at runtime to see valid values."],"exampleFix":"// before\nmlflow.sklearn.save_model(model, 'model', serialization_format='joblib')\n// after\nmlflow.sklearn.save_model(model, 'model', serialization_format='skops')","handlingStrategy":"validation","validationCode":"from mlflow.sklearn import SUPPORTED_SERIALIZATION_FORMATS\ndef valid_format(fmt: str) -> bool:\n    return fmt in SUPPORTED_SERIALIZATION_FORMATS","typeGuard":null,"tryCatchPattern":"from mlflow.exceptions import MlflowException\ntry:\n    mlflow.sklearn.save_model(model, path, serialization_format=fmt)\nexcept MlflowException as e:\n    if 'Unrecognized serialization format' in str(e):\n        mlflow.sklearn.save_model(model, path)  # default format\n    else:\n        raise","preventionTips":["Only use mlflow.sklearn.SERIALIZATION_FORMAT_* constants instead of raw strings","Default to 'skops' for safer serialization","Omit serialization_format to accept the default","Reference SUPPORTED_SERIALIZATION_FORMATS when writing tooling"],"tags":["sklearn","serialization","validation","parameters"],"backgroundTag":"invalid-parameter-value","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}