mlflow/mlflow · error · MlflowException
INVALID_PARAMETER_VALUE
INVALID_PARAMETER_VALUE
Error message
Unrecognized predictions format: '{predictions_format}' What it means
`PredictionsResponse.get()` supports converting predictions only to 'pandas' or 'ndarray' format. Any other `predictions_format` value raises INVALID_PARAMETER_VALUE.
Source
Thrown at mlflow/deployments/__init__.py:72
"""
import numpy as np
import pandas as pd
from pandas.core.dtypes.common import is_list_like
if predictions_format == "dataframe":
predictions = self["predictions"]
if isinstance(predictions, str):
return pd.DataFrame(data=[predictions])
if isinstance(predictions, dict) and not any(
is_list_like(p) and getattr(p, "ndim", 1) == 1 for p in predictions.values()
):
return pd.DataFrame(data=predictions, index=[0])
return pd.DataFrame(data=predictions)
elif predictions_format == "ndarray":
return np.array(self["predictions"], dtype)
else:
raise MlflowException(
f"Unrecognized predictions format: '{predictions_format}'",
INVALID_PARAMETER_VALUE,
)
def to_json(self, path=None):
"""Get the JSON representation of the MLflow Predictions Response.
Args:
path: If specified, the JSON representation is written to this file path.
Returns:
If ``path`` is unspecified, the JSON representation of the MLflow Predictions
Response. Else, None.
"""
if path is not None:
with open(path, "w") as f:
json.dump(dict(self), f)View on GitHub (pinned to 6a27f2decc)
Solutions
- Use `predictions_format='pandas'` or `predictions_format='ndarray'` exactly
- Fix the typo if 'numpy' was intended — the correct value is 'ndarray'
- Call `.to_dict()`/`.to_json()` if you need raw JSON instead of the typed converters
Example fix
// before resp.get(predictions_format='numpy') // after resp.get(predictions_format='ndarray')
Defensive patterns
Strategy: validation
Validate before calling
VALID = {'pandas', 'ndarray'}
assert predictions_format in VALID, f'unsupported format: {predictions_format}' Type guard
def is_valid_predictions_format(fmt) -> bool:
return fmt in ('pandas', 'ndarray') Try / catch
try:
preds = response.get(predictions_format=fmt)
except MlflowException as e:
if 'Unrecognized predictions format' in str(e):
preds = response.get(predictions_format='pandas')
else:
raise Prevention
- Only use 'pandas' or 'ndarray' as predictions_format
- Watch for 'numpy' — the correct token is 'ndarray'
- Centralize the format constant in your calling code
When it happens
Trigger: Calling `mlflow.deployments.predict(...)` or a `PredictionsResponse`'s `get(predictions_format=...)` with a format string other than 'pandas' or 'ndarray' (e.g. 'numpy', 'df', 'json').
Common situations: Typos like 'numpy' instead of 'ndarray'; passing None/other objects where a string format is expected; copying examples from other libraries' client APIs.
Related errors
- Invalid model type: '{model_type}'. Must be one of {list(mod
- Predictions response contents are not valid JSON
- Invalid response. Predictions response contents must be a di
- Computing model explanations is not yet supported for this d
- Method is unimplemented in base client. Implementation shoul
AI-assisted analysis of mlflow/mlflow@6a27f2decc (2026-08-29).
Data as JSON: /api/errors/2d9cc0b0333be202.
Report an issue: GitHub.