{"record":{"id":"ea7f0f1248aa3fd5","repo":"mlflow/mlflow","slug":"the-entry-point-entry-point-is-not-defined-in","errorCode":null,"errorMessage":"The entry point '{entry_point}' is not defined in the Databricks spark job MLproject file.","messagePattern":"The entry point '(.+?)' is not defined in the Databricks spark job MLproject file\\.","errorType":"exception","errorClass":"MlflowException","httpStatus":null,"severity":"error","filePath":"mlflow/projects/_project_spec.py","lineNumber":224,"sourceCode":"        databricks_spark_job_spec=None,\n    ):\n        self.env_type = env_type\n        self.env_config_path = env_config_path\n        self._entry_points = entry_points\n        self.docker_env = docker_env\n        self.name = name\n        self.databricks_spark_job_spec = databricks_spark_job_spec\n\n    def get_entry_point(self, entry_point):\n        if self.databricks_spark_job_spec:\n            if self.databricks_spark_job_spec.python_file is not None:\n                # If Databricks Spark job is configured with python_file field,\n                # it does not need to configure entry_point section\n                # and the 'entry_point' param in 'mlflow run' command is ignored\n                return None\n\n            if self._entry_points is None or entry_point not in self._entry_points:\n                raise MlflowException(\n                    f\"The entry point '{entry_point}' is not defined in the Databricks spark job \"\n                    f\"MLproject file.\"\n                )\n\n        if entry_point in self._entry_points:\n            return self._entry_points[entry_point]\n        _, file_extension = os.path.splitext(entry_point)\n        ext_to_cmd = {\".py\": \"python\", \".sh\": os.environ.get(\"SHELL\", \"bash\")}\n        if file_extension in ext_to_cmd:\n            command = f\"{ext_to_cmd[file_extension]} {quote(entry_point)}\"\n            if not is_string_type(command):\n                command = command.encode(\"utf-8\")\n            return EntryPoint(name=entry_point, parameters={}, command=command)\n        elif file_extension == \".R\":\n            command = f\"Rscript -e \\\"mlflow::mlflow_source('{quote(entry_point)}')\\\" --args\"\n            return EntryPoint(name=entry_point, parameters={}, command=command)\n        raise ExecutionException(\n            \"Could not find {0} among entry points {1} or interpret {0} as a \"","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/projects/_project_spec.py#L206-L242","documentation":"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.","triggerScenarios":"`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).","commonSituations":"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.","solutions":["Run with an entry point name that matches a key in the MLproject `entry_points:` section (check exact spelling/case)","If the project should run a script instead, configure python_file in the Databricks job spec so entry_point is ignored","List available entry points by reading the MLproject file (`entry_points` keys) and pick one","For no specific entry, try omitting `-e` if a 'main' entry point exists"],"exampleFix":"# before\n# mlflow run . -e tarin_step --backend databricks\n# after (MLproject defines 'train_step')\n# mlflow run . -e train_step --backend databricks","handlingStrategy":"validation","validationCode":"import yaml\ndef get_entry_points(project_dir):\n    spec = yaml.safe_load(open(f'{project_dir.rstrip(\"/\")}/MLproject'))\n    return list((spec.get('entry_points') or {}).keys())\n\n# assert requested name before running:\n# assert entry in get_entry_points('.'), f\"{entry} not in entry points\"","typeGuard":null,"tryCatchPattern":"from mlflow.exceptions import MlflowException\ntry:\n    mlflow.projects.run(uri, entry_point=name, backend='databricks')\nexcept MlflowException as e:\n    if 'not defined in the Databricks spark job' in str(e):\n        print('Choose a valid entry point:', e)","preventionTips":["Cross-check -e values against the MLproject entry_points keys","Remember Databricks spark job projects ignore -e only when python_file is configured","Keep entry point names in CI scripts in sync with MLproject","Avoid renaming entry points without updating callers"],"tags":["mlflow","projects","databricks","entry-point","configuration"],"backgroundTag":"unknown-entry-point","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}