mlflow/mlflow · error · MlflowException

The entry point '{entry_point}' is not defined in the Databr

Error message

The entry point '{entry_point}' is not defined in the Databricks spark job MLproject file.

What it means

For Databricks spark job projects, Project.get_entry_point raises MlflowException when the requested entry point is not among the entry points defined in the MLproject file (and the project does not use a python_file that makes entry points irrelevant). This happens in the Databricks-specific branch of get_entry_point.

Source

Thrown at mlflow/projects/_project_spec.py:224

        databricks_spark_job_spec=None,
    ):
        self.env_type = env_type
        self.env_config_path = env_config_path
        self._entry_points = entry_points
        self.docker_env = docker_env
        self.name = name
        self.databricks_spark_job_spec = databricks_spark_job_spec

    def get_entry_point(self, entry_point):
        if self.databricks_spark_job_spec:
            if self.databricks_spark_job_spec.python_file is not None:
                # If Databricks Spark job is configured with python_file field,
                # it does not need to configure entry_point section
                # and the 'entry_point' param in 'mlflow run' command is ignored
                return None

            if self._entry_points is None or entry_point not in self._entry_points:
                raise MlflowException(
                    f"The entry point '{entry_point}' is not defined in the Databricks spark job "
                    f"MLproject file."
                )

        if entry_point in self._entry_points:
            return self._entry_points[entry_point]
        _, file_extension = os.path.splitext(entry_point)
        ext_to_cmd = {".py": "python", ".sh": os.environ.get("SHELL", "bash")}
        if file_extension in ext_to_cmd:
            command = f"{ext_to_cmd[file_extension]} {quote(entry_point)}"
            if not is_string_type(command):
                command = command.encode("utf-8")
            return EntryPoint(name=entry_point, parameters={}, command=command)
        elif file_extension == ".R":
            command = f"Rscript -e \"mlflow::mlflow_source('{quote(entry_point)}')\" --args"
            return EntryPoint(name=entry_point, parameters={}, command=command)
        raise ExecutionException(
            "Could not find {0} among entry points {1} or interpret {0} as a "

View on GitHub (pinned to 6a27f2decc)

Solutions

  1. Run with an entry point name that matches a key in the MLproject `entry_points:` section (check exact spelling/case)
  2. If the project should run a script instead, configure python_file in the Databricks job spec so entry_point is ignored
  3. List available entry points by reading the MLproject file (`entry_points` keys) and pick one
  4. For no specific entry, try omitting `-e` if a 'main' entry point exists

Example fix

# before
# mlflow run . -e tarin_step --backend databricks
# after (MLproject defines 'train_step')
# mlflow run . -e train_step --backend databricks
Defensive patterns

Strategy: validation

Validate before calling

import yaml
def get_entry_points(project_dir):
    spec = yaml.safe_load(open(f'{project_dir.rstrip("/")}/MLproject'))
    return list((spec.get('entry_points') or {}).keys())

# assert requested name before running:
# assert entry in get_entry_points('.'), f"{entry} not in entry points"

Try / catch

from mlflow.exceptions import MlflowException
try:
    mlflow.projects.run(uri, entry_point=name, backend='databricks')
except MlflowException as e:
    if 'not defined in the Databricks spark job' in str(e):
        print('Choose a valid entry point:', e)

Prevention

When it happens

Trigger: `mlflow run <databricks-spark-job-project> -e my_step` where `my_step` is not a key under `entry_points:` in the Databricks spark job MLproject, and the project configures `entry_points` (no top-level python_file fallback).

Common situations: Typo in the `-e` entry point name; running the default entry point name 'main' on a project that defines different names; MLproject entry points renamed during refactoring; confusing this with non-Databricks projects where a script file can substitute.

Related errors


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