mlflow/mlflow · error · MlflowException

Model inference is missing inputs. The model signature decla

Error message

Model inference is missing inputs. The model signature declares {} inputs  but the provided value only has {} inputs. Note: the inputs were not named in the signature so we can only verify their count.

What it means

When a column-based signature does not name its inputs, MLflow can only check the column count. This error fires when the input DataFrame has fewer columns than the signature declares, meaning inputs are missing (though which ones cannot be identified).

Source

Thrown at mlflow/models/utils.py:1272

                message = "Input schema validation failed. Mismatched or missing input(s)."
                if extra_cols:
                    message += " Note that there were extra inputs provided."
            else:
                message = f"Model is missing inputs {missing_cols}."
                if extra_cols:
                    message += f" Note that there were extra inputs: {extra_cols}."
            raise MlflowException(message)

        if extra_cols:
            _logger.warning(
                "Found extra inputs in the model input that are not defined in the model "
                f"signature: `{extra_cols}`. These inputs will be ignored."
            )
    elif not input_schema.is_tensor_spec():
        # The model signature does not specify column names => we can only verify column count.
        num_actual_columns = len(pf_input.columns)
        if num_actual_columns < len(input_schema.inputs):
            raise MlflowException(
                "Model inference is missing inputs. The model signature declares "
                "{} inputs  but the provided value only has "
                "{} inputs. Note: the inputs were not named in the signature so we can "
                "only verify their count.".format(len(input_schema.inputs), num_actual_columns)
            )
    if input_schema.is_tensor_spec():
        return _enforce_tensor_schema(pf_input, input_schema)
    elif HAS_PYSPARK and isinstance(original_pf_input, SparkDataFrame):
        return _enforce_pyspark_dataframe_schema(
            original_pf_input, pf_input, input_schema, flavor=flavor
        )
    else:
        # pf_input must be a pandas Dataframe at this point
        return (
            _enforce_named_col_schema(pf_input, input_schema)
            if input_schema.has_input_names()
            else _enforce_unnamed_col_schema(pf_input, input_schema)
        )

View on GitHub (pinned to 6a27f2decc)

Solutions

  1. Add the missing feature columns so the DataFrame has exactly len(model.input_schema.inputs) columns in the same order as the signature.
  2. Check the count: len(df.columns) vs len(model.input_schema.inputs) before predict.
  3. Re-log the model with a named column signature so errors pinpoint missing columns by name.

Example fix

// before
model.predict(df)  # df has 3 columns, signature declares 5

// after
assert len(df.columns) == len(model.input_schema.inputs), \
    f"expected {len(model.input_schema.inputs)} columns"
model.predict(df)
Defensive patterns

Strategy: validation

Validate before calling

expected = len(model.input_schema.inputs)
if len(df.columns) < expected:
    raise ValueError(f"Signature expects {expected} columns, got {len(df.columns)}")

Prevention

When it happens

Trigger: Predict/validate_schema with a DataFrame having fewer columns than len(input_schema.inputs) for a signature with unnamed inputs (e.g. from infer_signature on a numpy array or nameless schema).

Common situations: Serving data with fewer features than training; feature-selection step dropping columns; passing a wide-format subset of the training feature matrix.

Related errors


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