mlflow/mlflow · error · MlflowException
INVALID_PARAMETER_VALUE
INVALID_PARAMETER_VALUE
Error message
Content type must be one of {_CONTENT_TYPE_JSON} or {_CONTENT_TYPE_CSV}. What it means
mlflow.models.predict only accepts 'json' or 'csv' as content_type when testing a pyfunc model locally. Any other content_type value raises MlflowException.invalid_parameter_value immediately, before any input is read.
Source
Thrown at mlflow/models/python_api.py:230
input_data={"x": 1, "y": 2},
env_manager="uv",
output_path="output.json",
)
# Run prediction with pre-release versions
mlflow.models.predict(
model_uri=f"runs:/{run_id}/model",
input_data={"x": 1, "y": 2},
env_manager="uv",
extra_envs={"UV_PRERELEASE": "allow"},
)
"""
# to avoid circular imports
from mlflow.pyfunc import _PREBUILD_ENV_ROOT_LOCATION
if content_type not in [_CONTENT_TYPE_JSON, _CONTENT_TYPE_CSV]:
raise MlflowException.invalid_parameter_value(
f"Content type must be one of {_CONTENT_TYPE_JSON} or {_CONTENT_TYPE_CSV}."
)
if extra_envs and env_manager not in (
_EnvManager.VIRTUALENV,
_EnvManager.CONDA,
_EnvManager.UV,
):
raise MlflowException.invalid_parameter_value(
"Extra environment variables are only supported when env_manager is "
f"set to '{_EnvManager.VIRTUALENV}', '{_EnvManager.CONDA}' or '{_EnvManager.UV}'."
)
if env_manager == _EnvManager.UV:
if not shutil.which("uv"):
raise MlflowException(
f"Found '{env_manager}' as env_manager, but the 'uv' command is not found in the "
f"PATH. {UV_INSTALLATION_INSTRUCTIONS} Alternatively, you can use 'virtualenv' or "
"'conda' as the environment manager, but note their performances are not "
"as good as 'uv'."View on GitHub (pinned to 6a27f2decc)
Solutions
- Set content_type="json" or content_type="csv" (lowercase literals).
- Omit content_type only when the input doesn't need serialization guidance (JSON path).
- If data is a DataFrame, use content_type="csv" or pass it directly as input_data with json-compatible types.
Example fix
// before predict(model_uri=uri, input_data=df, content_type="text/csv") // after predict(model_uri=uri, input_data=df, content_type="csv")
Defensive patterns
Strategy: validation
Validate before calling
def valid_content_type(ct):
return ct in ("json", "csv") Try / catch
try:
predict(model_uri=uri, input_data=data, content_type=ct)
except MlflowException as e:
if e.error_code == "INVALID_PARAMETER_VALUE":
print("use content_type='json' or 'csv'") Prevention
- Only use the lowercase literals "json" and "csv".
- Don't copy HTTP MIME types into this parameter.
When it happens
Trigger: Calling mlflow.models.predict(model_uri=..., input_data=..., content_type='json/object') or 'application/json', 'text/csv', 'parquet', or passing an uppercase 'JSON'.
Common situations: Copying a content type from an HTTP API call (application/json) into the Python API; confusing this parameter with serving-input content types; typos like 'jsn'.
Related errors
- base_model must be a non-empty string (HuggingFace model ID
- Unsupported adapter type: {adapter_type}. Supported types: {
- created_time is required
- last_update_time is required
- Invalid lifecycle stage '{lifecycle_stage}'
AI-assisted analysis of mlflow/mlflow@6a27f2decc (2026-08-29).
Data as JSON: /api/errors/adb99dbaf50b00f4.
Report an issue: GitHub.