mlflow/mlflow · error · MlflowException

INVALID_PARAMETER_VALUE

INVALID_PARAMETER_VALUE

Error message

Unrecognized serialization format: {serialization_format}. Please specify one of the following supported formats: {SUPPORTED_SERIALIZATION_FORMATS}.

What it means

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.

Source

Thrown at mlflow/sklearn/__init__.py:261

            sk_path_dir_1,
            serialization_format=mlflow.sklearn.SERIALIZATION_FORMAT_CLOUDPICKLE,
        )

        # save the model in pickle format
        # set path to location for persistence
        sk_path_dir_2 = ...
        mlflow.sklearn.save_model(
            sk_model,
            sk_path_dir_2,
            serialization_format=mlflow.sklearn.SERIALIZATION_FORMAT_PICKLE,
        )
    """
    import sklearn

    _validate_env_arguments(conda_env, pip_requirements, extra_pip_requirements)

    if serialization_format not in SUPPORTED_SERIALIZATION_FORMATS:
        raise MlflowException(
            message=(
                f"Unrecognized serialization format: {serialization_format}. Please specify one"
                f" of the following supported formats: {SUPPORTED_SERIALIZATION_FORMATS}."
            ),
            error_code=INVALID_PARAMETER_VALUE,
        )

    if serialization_format != SERIALIZATION_FORMAT_SKOPS and not is_in_databricks_runtime():
        _logger.warning(
            "Saving scikit-learn models in the pickle or cloudpickle format requires exercising "
            "caution because these formats rely on Python's object serialization mechanism, "
            "which can execute arbitrary code during deserialization. "
            "The recommended safe alternative is the 'skops' format. "
            "For more information, see: https://scikit-learn.org/stable/model_persistence.html",
        )

    _validate_and_prepare_target_save_path(path)
    code_path_subdir = _validate_and_copy_code_paths(code_paths, path)

View on GitHub (pinned to 6a27f2decc)

Solutions

  1. Use one of: 'skops' (recommended, safer), 'pickle', or 'cloudpickle' — or omit the parameter to use the default ('pickle').
  2. Fix typos in the format string (exact match, lowercase).
  3. If you need joblib serialization, use joblib directly outside MLflow or keep the model as pickle via MLflow.
  4. Check mlflow.sklearn.SUPPORTED_SERIALIZATION_FORMATS at runtime to see valid values.

Example fix

// before
mlflow.sklearn.save_model(model, 'model', serialization_format='joblib')
// after
mlflow.sklearn.save_model(model, 'model', serialization_format='skops')
Defensive patterns

Strategy: validation

Validate before calling

from mlflow.sklearn import SUPPORTED_SERIALIZATION_FORMATS
def valid_format(fmt: str) -> bool:
    return fmt in SUPPORTED_SERIALIZATION_FORMATS

Try / catch

from mlflow.exceptions import MlflowException
try:
    mlflow.sklearn.save_model(model, path, serialization_format=fmt)
except MlflowException as e:
    if 'Unrecognized serialization format' in str(e):
        mlflow.sklearn.save_model(model, path)  # default format
    else:
        raise

Prevention

When it happens

Trigger: Calling mlflow.sklearn.save_model(sk_model, path, serialization_format='joblib') or any misspelled/unsupported format string.

Common situations: Confusing joblib with MLflow's supported formats; typos like 'pkl' or 'cloud_pickle'; copying code from older examples using formats MLflow never supported.

Related errors


AI-assisted analysis of mlflow/mlflow@6a27f2decc (2026-08-29). Data as JSON: /api/errors/e1d0a1368ec36e19. Report an issue: GitHub.