mlflow/mlflow · error · MlflowException

DBFS path {dbfs_path} does not exist

Error message

DBFS path {dbfs_path} does not exist

What it means

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.

Source

Thrown at mlflow/store/artifact/dbfs_artifact_repo.py:108

            try:
                for content in response.iter_content(chunk_size=DOWNLOAD_CHUNK_SIZE):
                    f.write(content)
            finally:
                response.close()

    def _is_directory(self, artifact_path):
        dbfs_path = self._get_dbfs_path(artifact_path) if artifact_path else self._get_dbfs_path("")
        return self._dbfs_is_dir(dbfs_path)

    def _dbfs_is_dir(self, dbfs_path):
        response = self._databricks_api_request(
            endpoint=GET_STATUS_ENDPOINT, method="GET", params={"path": dbfs_path}
        )
        json_response = json.loads(response.text)
        try:
            return json_response["is_dir"]
        except KeyError:
            raise MlflowException(f"DBFS path {dbfs_path} does not exist")

    def _get_dbfs_path(self, artifact_path):
        return "/{}/{}".format(
            strip_scheme(self.artifact_uri).lstrip("/"),
            artifact_path.lstrip("/"),
        )

    def _get_dbfs_endpoint(self, artifact_path):
        return f"/dbfs{self._get_dbfs_path(artifact_path)}"

    def log_artifact(self, local_file, artifact_path=None):
        basename = os.path.basename(local_file)
        if artifact_path:
            http_endpoint = self._get_dbfs_endpoint(posixpath.join(artifact_path, basename))
        else:
            http_endpoint = self._get_dbfs_endpoint(basename)
        if os.stat(local_file).st_size == 0:
            # The API frontend doesn't like it when we post empty files to it using

View on GitHub (pinned to 6a27f2decc)

Solutions

  1. Verify the dbfs path exists (databricks fs ls <path> via CLI) and fix the artifact_uri/path.
  2. Confirm you are authenticated against the intended Databricks workspace (host/profile credentials).
  3. Wrap existence checks in try/except and treat 'does not exist' as an empty artifact listing when appropriate.

Example fix

// before
infos = repo.list_artifacts("outputs")  # raises if missing

// after
try:
    infos = repo.list_artifacts("outputs")
except MlflowException as e:
    if "does not exist" in str(e):
        infos = []
Defensive patterns

Strategy: try-catch

Validate before calling

from databricks.sdk import WorkspaceClient
exists = any(f.path == dbfs_path for f in WorkspaceClient().dbfs.list(parent=dbfs_path.rsplit('/',1)[0] or '/'))

Type guard

def dbfs_path_exists(client, path: str) -> bool:
    try:
        client.dbfs.get_status(path=path)
        return True
    except Exception:
        return False

Try / catch

try:
    infos = repo.list_artifacts(path)
except MlflowException as e:
    if "does not exist" in str(e):
        infos = []  # treat as empty

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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