mlflow/mlflow · error · MlflowException

RESOURCE_DOES_NOT_EXIST

RESOURCE_DOES_NOT_EXIST

Error message

Failed to download artifacts from path {artifact_path!r}, please ensure that the path is correct.

What it means

download_artifacts in runs_artifact_repo tries a direct run-artifact download and then a model-registered-artifact fallback; if both return None it cannot locate anything at the requested path. It raises MlflowException with RESOURCE_DOES_NOT_EXIST, meaning the artifact_path does not exist in the run's artifacts (nor as a registered model version artifact).

Source

Thrown at mlflow/store/artifact/runs_artifact_repo.py:232

        except Exception:
            _logger.debug(
                f"Failed to download artifacts from {self.artifact_uri}/{artifact_path}.",
                exc_info=True,
            )

        # If there are artifacts with the same name in the run and model, the model artifacts
        # will overwrite the run artifacts.
        model_out_path: str | None = None
        try:
            model_out_path = self._download_model_artifacts(artifact_path, dst_path=dst_path)
        except Exception:
            _logger.debug(
                f"Failed to download model artifacts from {self.artifact_uri}/{artifact_path}.",
                exc_info=True,
            )
        path = run_out_path or model_out_path
        if path is None:
            raise MlflowException(
                f"Failed to download artifacts from path {artifact_path!r}, "
                "please ensure that the path is correct.",
                error_code=RESOURCE_DOES_NOT_EXIST,
            )
        return path

    def _download_model_artifacts(self, artifact_path: str, dst_path: str) -> str | None:
        """
        A run can have an associated model. If so, this method downloads the artifacts of the model.
        """
        full_path = f"{self.artifact_uri}/{artifact_path}" if artifact_path else self.artifact_uri
        run_id, rel_path = RunsArtifactRepository.parse_runs_uri(full_path)
        if not rel_path:
            # At least one part of the path must be present (e.g. "runs:/<run_id>/<name>")
            return None
        [model_name, *rest] = rel_path.split("/", 1)
        rel_path = rest[0] if rest else ""
        if repo := self._get_logged_model_artifact_repo(run_id=run_id, name=model_name):

View on GitHub (pinned to 6a27f2decc)

Solutions

  1. Run mlflow.artifacts.list_artifacts(run_id) (or client.list_artifacts) to confirm the exact path
  2. Check the run_id is correct and the artifact store backend still holds the files
  3. If the artifact was logged under a nested path, include the full run-relative path

Example fix

// before
runs_repo.download_artifacts("model.pkl")  # actual path is models/model.pkl
// after
runs_repo.download_artifacts("models/model.pkl")
Defensive patterns

Strategy: validation

Validate before calling

from mlflow import MlflowClient
client = MlflowClient()
def artifact_exists(run_id, path):
    parts = path.split("/")
    dir, name = "/".join(parts[:-1]) or None, parts[-1]
    return any(f.path == path for f in client.list_artifacts(run_id, dir))

Try / catch

from mlflow.exceptions import MlflowException, RESOURCE_DOES_NOT_EXIST
try:
    local = repo.download_artifacts(artifact_path)
except MlflowException as e:
    if e.error_code == RESOURCE_DOES_NOT_EXIST:
        existing = [a.path for a in repo.list_artifacts()]
        raise FileNotFoundError(f"{artifact_path} not in run; have: {existing}") from e

Prevention

When it happens

Trigger: Calling download_artifacts(artifact_path) on a RunsArtifactRepository where the path does not exist in the run's artifact store and the model-version fallback also fails — e.g. typos in the path, or downloading from a run whose artifacts were deleted.

Common situations: Referring to artifacts from an old run whose artifact store was purged (e.g. S3 lifecycle policy); wrong run_id with a valid-looking path; using 'model' paths that only exist for model-version URIs, not plain runs.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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