{"record":{"id":"adb99dbaf50b00f4","repo":"mlflow/mlflow","slug":"invalid-parameter-value-adb99d","errorCode":"INVALID_PARAMETER_VALUE","errorMessage":"Content type must be one of {_CONTENT_TYPE_JSON} or {_CONTENT_TYPE_CSV}.","messagePattern":"Content type must be one of (.+?) or (.+?)\\.","errorType":"validation","errorClass":"MlflowException","httpStatus":null,"severity":"error","filePath":"mlflow/models/python_api.py","lineNumber":230,"sourceCode":"            input_data={\"x\": 1, \"y\": 2},\n            env_manager=\"uv\",\n            output_path=\"output.json\",\n        )\n\n        # Run prediction with pre-release versions\n        mlflow.models.predict(\n            model_uri=f\"runs:/{run_id}/model\",\n            input_data={\"x\": 1, \"y\": 2},\n            env_manager=\"uv\",\n            extra_envs={\"UV_PRERELEASE\": \"allow\"},\n        )\n\n    \"\"\"\n    # to avoid circular imports\n    from mlflow.pyfunc import _PREBUILD_ENV_ROOT_LOCATION\n\n    if content_type not in [_CONTENT_TYPE_JSON, _CONTENT_TYPE_CSV]:\n        raise MlflowException.invalid_parameter_value(\n            f\"Content type must be one of {_CONTENT_TYPE_JSON} or {_CONTENT_TYPE_CSV}.\"\n        )\n    if extra_envs and env_manager not in (\n        _EnvManager.VIRTUALENV,\n        _EnvManager.CONDA,\n        _EnvManager.UV,\n    ):\n        raise MlflowException.invalid_parameter_value(\n            \"Extra environment variables are only supported when env_manager is \"\n            f\"set to '{_EnvManager.VIRTUALENV}', '{_EnvManager.CONDA}' or '{_EnvManager.UV}'.\"\n        )\n    if env_manager == _EnvManager.UV:\n        if not shutil.which(\"uv\"):\n            raise MlflowException(\n                f\"Found '{env_manager}' as env_manager, but the 'uv' command is not found in the \"\n                f\"PATH. {UV_INSTALLATION_INSTRUCTIONS} Alternatively, you can use 'virtualenv' or \"\n                \"'conda' as the environment manager, but note their performances are not \"\n                \"as good as 'uv'.\"","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/models/python_api.py#L212-L248","documentation":"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.","triggerScenarios":"Calling mlflow.models.predict(model_uri=..., input_data=..., content_type='json/object') or 'application/json', 'text/csv', 'parquet', or passing an uppercase 'JSON'.","commonSituations":"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'.","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."],"exampleFix":"// before\npredict(model_uri=uri, input_data=df, content_type=\"text/csv\")\n// after\npredict(model_uri=uri, input_data=df, content_type=\"csv\")","handlingStrategy":"validation","validationCode":"def valid_content_type(ct):\n    return ct in (\"json\", \"csv\")","typeGuard":null,"tryCatchPattern":"try:\n    predict(model_uri=uri, input_data=data, content_type=ct)\nexcept MlflowException as e:\n    if e.error_code == \"INVALID_PARAMETER_VALUE\":\n        print(\"use content_type='json' or 'csv'\")","preventionTips":["Only use the lowercase literals \"json\" and \"csv\".","Don't copy HTTP MIME types into this parameter."],"tags":["python","validation","parameters"],"backgroundTag":"invalid-parameter-value","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}