mlflow/mlflow · error · MlflowException

Unable to download model artifacts from source artifact loca

Error message

Unable to download model artifacts from source artifact location '{source}' in order to upload them to Unity Catalog. Please ensure the source artifact location exists and that you can download from it via mlflow.artifacts.download_artifacts(). Original error: {e}

What it means

Before uploading model artifacts to Unity Catalog, MLflow downloads them from the source artifact location via mlflow.artifacts.download_artifacts. If that download fails (missing source, no permissions, unsupported/incorrect URI), this error wraps the original exception.

Source

Thrown at mlflow/store/_unity_catalog/registry/rest_store.py:884

            raise MlflowException(
                "Failed to download the model weights from the HuggingFace hub and cannot register "
                "the model in the Unity Catalog. Please ensure that the model was saved with the "
                "correct reference to the HuggingFace hub repository and that you have access to "
                "fetch model weights from the defined repository.",
                error_code=INTERNAL_ERROR,
            ) from e

    @contextmanager
    def _local_model_dir(self, source, local_model_path):
        if local_model_path is not None:
            yield local_model_path
        else:
            try:
                local_model_dir = mlflow.artifacts.download_artifacts(
                    artifact_uri=source, tracking_uri=self.tracking_uri
                )
            except Exception as e:
                raise MlflowException(
                    f"Unable to download model artifacts from source artifact location "
                    f"'{source}' in order to upload them to Unity Catalog. Please ensure "
                    f"the source artifact location exists and that you can download from "
                    f"it via mlflow.artifacts.download_artifacts(). Original error: {e}"
                ) from e
            try:
                yield local_model_dir
            finally:
                # Clean up temporary model directory at end of block. We assume a temporary
                # model directory was created if the `source` is not a local path
                # (must be downloaded from remote to a temporary directory) and
                # `local_model_dir` is not a FUSE-mounted path. The check for FUSE-mounted
                # paths is important as mlflow.artifacts.download_artifacts() can return
                # a FUSE mounted path equivalent to the (remote) source path in some cases,
                # e.g. return /dbfs/some/path for source dbfs:/some/path.
                if not os.path.exists(source) and not is_fuse_or_uc_volumes_uri(local_model_dir):
                    shutil.rmtree(local_model_dir)

View on GitHub (pinned to 6a27f2decc)

Solutions

  1. Verify mlflow.artifacts.download_artifacts(source) works manually and check the URI exists.
  2. Fix storage credentials/permissions (cloud creds, instance profile, service principal) for the artifact location.
  3. Register from the correct run/source URI of an existing run.
  4. Copy artifacts to an accessible location and register from there.

Example fix

// before
client.create_model_version(name, source="s3://wrong-bucket/model")
// after
import mlflow.artifacts
local = mlflow.artifacts.download_artifacts("s3://correct-bucket/model")  # verify first
client.create_model_version(name, source="s3://correct-bucket/model")
Defensive patterns

Strategy: try-catch

Validate before calling

import mlflow.artifacts
local_dir = mlflow.artifacts.download_artifacts(artifact_uri=source)  # fail fast pre-registration

Try / catch

try:
    client.create_model_version(name, source=source, run_id=run_id)
except MlflowException as e:
    if "Unable to download model artifacts" in str(e):
        print("Check source exists and creds:", source, e)
    raise

Prevention

When it happens

Trigger: Creating a model version whose source artifact URI is nonexistent, deleted, in a different unreachable tracking server, or lacks read permissions; e.g. registering from an expired/deleted run or wrong storage credentials.

Common situations: Source run's artifacts deleted; cross-workspace registration without access; misconfigured S3/ADLS credentials; typo in source path.

Related errors


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