mlflow/mlflow · error · MlflowException

INVALID_PARAMETER_VALUE

INVALID_PARAMETER_VALUE

Error message

Invalid dataset constructor name: {constructor_name}. Constructor name must start with 'load_' or 'from_'.

What it means

When registering a dataset constructor with DatasetRegistry.register_constructor, the name must start with 'load_' or 'from_' so it reads like a factory method on mlflow.data. Registering e.g. 'get_my_data' fails validation with INVALID_PARAMETER_VALUE. This enforces the public API convention that dataset builders are accessed as mlflow.data.load_* or from_*.

Source

Thrown at mlflow/data/dataset_registry.py:70

        for entrypoint in get_entry_points("mlflow.dataset_constructor"):
            try:
                self.register_constructor(
                    constructor_fn=entrypoint.load(), constructor_name=entrypoint.name
                )
            except Exception as exc:
                warnings.warn(
                    f"Failure attempting to register dataset constructor"
                    f' "{entrypoint.name}": {exc}.',
                    stacklevel=2,
                )

    @staticmethod
    def _validate_constructor(
        constructor_fn: Callable[[str | None, str | None], Dataset],
        constructor_name: str,
    ):
        if not constructor_name.startswith("load_") and not constructor_name.startswith("from_"):
            raise MlflowException(
                f"Invalid dataset constructor name: {constructor_name}."
                f" Constructor name must start with 'load_' or 'from_'.",
                INVALID_PARAMETER_VALUE,
            )

        signature = inspect.signature(constructor_fn)
        parameters = signature.parameters
        for expected_kwarg in ["name", "digest"]:
            if expected_kwarg not in parameters or parameters[expected_kwarg].kind not in [
                inspect.Parameter.KEYWORD_ONLY,
                inspect.Parameter.POSITIONAL_OR_KEYWORD,
            ]:
                raise MlflowException(
                    f"Invalid dataset constructor function: {constructor_fn.__name__}. Function"
                    f" must define an optional parameter named '{expected_kwarg}'.",
                    INVALID_PARAMETER_VALUE,
                )

View on GitHub (pinned to 6a27f2decc)

Solutions

  1. Rename the constructor name to start with 'load_' (e.g. 'load_internal_dataset') or 'from_' (e.g. 'from_spark_table').
  2. Keep the function name itself and pass a compliant constructor_name string to register_constructor.

Example fix

// before
registry.register_constructor(my_loader, "my_data")
// after
registry.register_constructor(my_loader, "load_my_data")
Defensive patterns

Strategy: validation

Validate before calling

assert constructor_name.startswith(("load_", "from_")), f"{constructor_name} must start with load_ or from_"

Try / catch

try:
    registry.register_constructor(fn, name)
except MlflowException as e:
    if "must start with 'load_'" in str(e):
        registry.register_constructor(fn, f"load_{name}")

Prevention

When it happens

Trigger: Calling registry.register_constructor(constructor_fn, constructor_name) where constructor_name does not begin with 'load_' or 'from_', e.g. 'fetch_data' or 'MyDatasetBuilder'.

Common situations: Teams building custom dataset factories for internal data lakes and naming the entry point after their business function rather than the load_/from_ convention.

Related errors


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