{"record":{"id":"2d9cc0b0333be202","repo":"mlflow/mlflow","slug":"invalid-parameter-value-2d9cc0","errorCode":"INVALID_PARAMETER_VALUE","errorMessage":"Unrecognized predictions format: '{predictions_format}'","messagePattern":"Unrecognized predictions format: '(.+?)'","errorType":"validation","errorClass":"MlflowException","httpStatus":null,"severity":"error","filePath":"mlflow/deployments/__init__.py","lineNumber":72,"sourceCode":"\n        \"\"\"\n        import numpy as np\n        import pandas as pd\n        from pandas.core.dtypes.common import is_list_like\n\n        if predictions_format == \"dataframe\":\n            predictions = self[\"predictions\"]\n            if isinstance(predictions, str):\n                return pd.DataFrame(data=[predictions])\n            if isinstance(predictions, dict) and not any(\n                is_list_like(p) and getattr(p, \"ndim\", 1) == 1 for p in predictions.values()\n            ):\n                return pd.DataFrame(data=predictions, index=[0])\n            return pd.DataFrame(data=predictions)\n        elif predictions_format == \"ndarray\":\n            return np.array(self[\"predictions\"], dtype)\n        else:\n            raise MlflowException(\n                f\"Unrecognized predictions format: '{predictions_format}'\",\n                INVALID_PARAMETER_VALUE,\n            )\n\n    def to_json(self, path=None):\n        \"\"\"Get the JSON representation of the MLflow Predictions Response.\n\n        Args:\n            path: If specified, the JSON representation is written to this file path.\n\n        Returns:\n            If ``path`` is unspecified, the JSON representation of the MLflow Predictions\n            Response. Else, None.\n\n        \"\"\"\n        if path is not None:\n            with open(path, \"w\") as f:\n                json.dump(dict(self), f)","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/deployments/__init__.py#L54-L90","documentation":"`PredictionsResponse.get()` supports converting predictions only to 'pandas' or 'ndarray' format. Any other `predictions_format` value raises INVALID_PARAMETER_VALUE.","triggerScenarios":"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').","commonSituations":"Typos like 'numpy' instead of 'ndarray'; passing None/other objects where a string format is expected; copying examples from other libraries' client APIs.","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"],"exampleFix":"// before\nresp.get(predictions_format='numpy')\n// after\nresp.get(predictions_format='ndarray')","handlingStrategy":"validation","validationCode":"VALID = {'pandas', 'ndarray'}\nassert predictions_format in VALID, f'unsupported format: {predictions_format}'","typeGuard":"def is_valid_predictions_format(fmt) -> bool:\n    return fmt in ('pandas', 'ndarray')","tryCatchPattern":"try:\n    preds = response.get(predictions_format=fmt)\nexcept MlflowException as e:\n    if 'Unrecognized predictions format' in str(e):\n        preds = response.get(predictions_format='pandas')\n    else:\n        raise","preventionTips":["Only use 'pandas' or 'ndarray' as predictions_format","Watch for 'numpy' — the correct token is 'ndarray'","Centralize the format constant in your calling code"],"tags":["deployments","client","invalid-argument"],"backgroundTag":"invalid-parameter-value","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}