{"record":{"id":"2879cd5775496d29","repo":"mlflow/mlflow","slug":"dbfs-path-dbfs-path-does-not-exist","errorCode":null,"errorMessage":"DBFS path {dbfs_path} does not exist","messagePattern":"DBFS path (.+?) does not exist","errorType":"exception","errorClass":"MlflowException","httpStatus":null,"severity":"error","filePath":"mlflow/store/artifact/dbfs_artifact_repo.py","lineNumber":108,"sourceCode":"            try:\n                for content in response.iter_content(chunk_size=DOWNLOAD_CHUNK_SIZE):\n                    f.write(content)\n            finally:\n                response.close()\n\n    def _is_directory(self, artifact_path):\n        dbfs_path = self._get_dbfs_path(artifact_path) if artifact_path else self._get_dbfs_path(\"\")\n        return self._dbfs_is_dir(dbfs_path)\n\n    def _dbfs_is_dir(self, dbfs_path):\n        response = self._databricks_api_request(\n            endpoint=GET_STATUS_ENDPOINT, method=\"GET\", params={\"path\": dbfs_path}\n        )\n        json_response = json.loads(response.text)\n        try:\n            return json_response[\"is_dir\"]\n        except KeyError:\n            raise MlflowException(f\"DBFS path {dbfs_path} does not exist\")\n\n    def _get_dbfs_path(self, artifact_path):\n        return \"/{}/{}\".format(\n            strip_scheme(self.artifact_uri).lstrip(\"/\"),\n            artifact_path.lstrip(\"/\"),\n        )\n\n    def _get_dbfs_endpoint(self, artifact_path):\n        return f\"/dbfs{self._get_dbfs_path(artifact_path)}\"\n\n    def log_artifact(self, local_file, artifact_path=None):\n        basename = os.path.basename(local_file)\n        if artifact_path:\n            http_endpoint = self._get_dbfs_endpoint(posixpath.join(artifact_path, basename))\n        else:\n            http_endpoint = self._get_dbfs_endpoint(basename)\n        if os.stat(local_file).st_size == 0:\n            # The API frontend doesn't like it when we post empty files to it using","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/store/artifact/dbfs_artifact_repo.py#L90-L126","documentation":"When checking whether a DBFS path is a directory, DbfsArtifactRepo._dbfs_is_dir calls the DBFS get-status API and expects an is_dir key in the JSON response. Databricks omits that key when the path does not exist, so the KeyError handler raises MlflowException stating the path does not exist.","triggerScenarios":"mlflow.artifacts.list_artifacts / _is_directory on a dbfs:/ URI whose underlying path was deleted, never created, or mis-typed; calling repo.list_artifacts on an empty/nonexistent root path.","commonSituations":"Typo in dbfs path; artifact directory deleted by a retention/cleanup job; wrong Databricks workspace (different host credentials) so the path genuinely is absent; checking a file path vs directory confusion.","solutions":["Verify the dbfs path exists (databricks fs ls <path> via CLI) and fix the artifact_uri/path.","Confirm you are authenticated against the intended Databricks workspace (host/profile credentials).","Wrap existence checks in try/except and treat 'does not exist' as an empty artifact listing when appropriate."],"exampleFix":"// before\ninfos = repo.list_artifacts(\"outputs\")  # raises if missing\n\n// after\ntry:\n    infos = repo.list_artifacts(\"outputs\")\nexcept MlflowException as e:\n    if \"does not exist\" in str(e):\n        infos = []","handlingStrategy":"try-catch","validationCode":"from databricks.sdk import WorkspaceClient\nexists = any(f.path == dbfs_path for f in WorkspaceClient().dbfs.list(parent=dbfs_path.rsplit('/',1)[0] or '/'))","typeGuard":"def dbfs_path_exists(client, path: str) -> bool:\n    try:\n        client.dbfs.get_status(path=path)\n        return True\n    except Exception:\n        return False","tryCatchPattern":"try:\n    infos = repo.list_artifacts(path)\nexcept MlflowException as e:\n    if \"does not exist\" in str(e):\n        infos = []  # treat as empty","preventionTips":["Verify the dbfs path exists with `databricks fs ls` before listing artifacts.","Confirm host/profile credentials target the intended Databricks workspace.","Don't delete artifact directories your runs still reference."],"tags":["databricks","dbfs","not-found","artifacts"],"backgroundTag":"path-not-found","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}