mlflow/mlflow · error · MlflowException

RESOURCE_DOES_NOT_EXIST

RESOURCE_DOES_NOT_EXIST

Error message

Failed to download an "MLMODEL" model file from "{model_uri}"

What it means

`set_signature` must download the MLmodel file from the resolved artifact URI to attach the signature. If the download fails for any reason (missing artifact, bad URI, permissions, connectivity), it is wrapped as RESOURCE_DOES_NOT_EXIST with this message and the original exception chained as the cause.

Source

Thrown at mlflow/models/signature.py:642

    )
    resolved_uri = model_uri
    if RunsArtifactRepository.is_runs_uri(model_uri):
        resolved_uri = RunsArtifactRepository.get_underlying_uri(model_uri)
    elif ModelsArtifactRepository._is_logged_model_uri(model_uri):
        resolved_uri = ModelsArtifactRepository.get_underlying_uri(model_uri)
    elif ModelsArtifactRepository.is_models_uri(model_uri):
        raise MlflowException(
            f"Failed to set signature on {model_uri!r}. "
            "Model URIs with the `models:/<name>/<version>` scheme are not supported.",
            INVALID_PARAMETER_VALUE,
        )

    try:
        ml_model_file = _download_artifact_from_uri(
            artifact_uri=append_to_uri_path(resolved_uri, MLMODEL_FILE_NAME)
        )
    except Exception as ex:
        raise MlflowException(
            f'Failed to download an "{MLMODEL_FILE_NAME}" model file from "{model_uri}"',
            RESOURCE_DOES_NOT_EXIST,
        ) from ex
    model_meta = Model.load(ml_model_file)
    model_meta.signature = signature
    model_meta.save(ml_model_file)
    _upload_artifact_to_uri(ml_model_file, resolved_uri)

View on GitHub (pinned to 6a27f2decc)

Solutions

  1. Verify the URI points at the exact directory containing the MLmodel file: `MlflowClient().list_artifacts(uri)` should show `MLmodel`.
  2. Inspect `ex.__cause__` (the chained exception) to see the real download failure (auth, DNS, 404) and fix storage access/credentials.
  3. Re-log the model if its artifacts were deleted, then set the signature.
  4. Pass the signature at log time via `mlflow.log_model(..., signature=signature)` instead of patching after the fact.

Example fix

// before
set_signature("runs:/<run_id>", signature)  # run root, no MLmodel
// after
set_signature("runs:/<run_id>/model", signature)  # dir containing MLmodel
Defensive patterns

Strategy: try-catch

Validate before calling

client = MlflowClient()
files = [a.path for a in client.list_artifacts(resolved_uri)]
if "MLmodel" not in files:
    raise ValueError(f"No MLmodel file under {resolved_uri}; got {files}")

Try / catch

try:
    mlflow.models.set_signature(model_uri, signature)
except MlflowException as e:
    if e.error_code == "RESOURCE_DOES_NOT_EXIST":
        logger.error("MLmodel download failed: %s", e.__cause__)
        raise
    raise

Prevention

When it happens

Trigger: `set_signature(uri, ...)` where the URI does not point to a directory containing MLmodel (e.g. a run root instead of the model artifact directory), the artifact was deleted, or the artifact store is unreachable/misconfigured (bad S3 credentials, wrong bucket).

Common situations: Pointing set_signature at a run root rather than the logged model path; expired cloud credentials; typos in artifact_path; a `models:/<model_id>` whose backing artifacts were deleted.

Related errors


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