mlflow/mlflow · error · MlflowException

INVALID_PARAMETER_VALUE

INVALID_PARAMETER_VALUE

Error message

Input messages should be list of dictionaries, but got: {type(messages)}.

What it means

Error "Input messages should be list of dictionaries, but got: {type(messages)}." thrown in mlflow/mlflow.

Source

Thrown at mlflow/transformers/llm_inference_utils.py:95

        raise MlflowException(
            f"When `task` is specified as `{inference_task}`, the signature would "
            "be set by MLflow. Please do not set the signature."
        )
    return inferred_signature


def convert_messages_to_prompt(messages: list[dict[str, Any]], tokenizer) -> str:
    """For the Chat inference task, apply chat template to messages to create prompt.

    Args:
        messages: List of message e.g. [{"role": user, "content": xxx}, ...]
        tokenizer: The tokenizer object used for inference.

    Returns:
        The prompt string contains the messages.
    """
    if not (isinstance(messages, list) and all(isinstance(msg, dict) for msg in messages)):
        raise MlflowException(
            f"Input messages should be list of dictionaries, but got: {type(messages)}.",
            error_code=INVALID_PARAMETER_VALUE,
        )

    try:
        return tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
    except Exception as e:
        raise MlflowException(f"Failed to apply chat template: {e}")


def preprocess_llm_inference_input(
    data: pd.DataFrame | dict[str, Any],
    params: dict[str, Any] | None = None,
    flavor_config: dict[str, Any] | None = None,
) -> tuple[list[Any], dict[str, Any]]:
    """
    When a MLflow inference task is given, return updated `data` and `params` that
    - Extract the parameters from the input data (from the first row if passed multiple rows)

View on GitHub (pinned to 6a27f2decc)

When it happens

Trigger: Thrown at mlflow/transformers/llm_inference_utils.py:95 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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