mlflow/mlflow · error · MlflowException

Unsupported source model URI: '{src_model_uri}'. The `copy_m

Error message

Unsupported source model URI: '{src_model_uri}'. The `copy_model_version` API only copies models stored in the 'models:/' scheme.

What it means

MlflowClient.copy_model_version only supports copying versions whose source URI uses the models:/ scheme (it resolves name/version from an existing registry entry). Any other URI scheme — a plain path, s3://, runs:/, etc. — raises this MlflowException. It fails at the very first validation (urllib scheme check) before contacting the registry.

Source

Thrown at mlflow/tracking/client.py:4798

            src_model_uri = f"models:/my_workspace_model/1"
            uc_model_dst_name = "mycatalog.myschema.my_uc_model"
            uc_migrated_copy = client.copy_model_version(src_model_uri, uc_model_dst_name)
            print_model_version_info(uc_migrated_copy)

        .. code-block:: text
            :caption: Output

            Name: RandomForestRegression-staging
            Version: 1
            Source: runs:/53e08bb38f0c487fa36c5872515ed998/sklearn-model
            --
            Name: RandomForestRegression-production
            Version: 1
            Source: models:/RandomForestRegression-staging/1
        """
        if urllib.parse.urlparse(src_model_uri).scheme != "models":
            raise MlflowException(
                f"Unsupported source model URI: '{src_model_uri}'. The `copy_model_version` API "
                "only copies models stored in the 'models:/' scheme."
            )
        client = self._get_registry_client()
        try:
            src_name, src_version = get_model_name_and_version(client, src_model_uri)
            src_mv = client.get_model_version(src_name, src_version)
        except MlflowException as e:
            raise MlflowException(
                f"Failed to fetch model version from source model URI: '{src_model_uri}'. "
                f"Error: {e}"
            ) from e

        if has_prompt_tag(src_mv._tags):
            # Prompt should not be used as a model version
            raise MlflowException(
                f"Model with uri '{src_model_uri}' not found",
                RESOURCE_DOES_NOT_EXIST,

View on GitHub (pinned to 6a27f2decc)

Solutions

  1. Pass a models:/ URI of an existing registered model version, e.g. "models:/RandomForestRegression-staging/1".
  2. If copying from a raw source path, first create a model version in the source registry (create_model_version / log_model), then copy it.
  3. Resolve run-based URIs (runs:/...) to a registered model version before copying.
  4. Validate the scheme in calling code with urllib.parse.urlparse(src_model_uri).scheme == "models".

Example fix

// before
client.copy_model_version(dst_uri, "s3://bucket/models/m/1")
// after
src = client.get_model_version_by_alias("m", "staging")
client.copy_model_version(dst_uri, f"models:/{src.name}/{src.version}")
Defensive patterns

Strategy: validation

Validate before calling

import urllib.parse
if urllib.parse.urlparse(src_model_uri).scheme != "models":
    raise ValueError(f"src_model_uri must use models:/ scheme, got {src_model_uri!r}")

Type guard

def is_models_uri(uri: str) -> bool:
    import urllib.parse
    return urllib.parse.urlparse(uri).scheme == "models"

Try / catch

from mlflow.exceptions import MlflowException
try:
    mv = client.copy_model_version(dst_uri, src_model_uri)
except MlflowException as e:
    if "Unsupported source model URI" in str(e):
        mv = register_then_copy(client, dst_uri, src_model_uri)
    else:
        raise

Prevention

When it happens

Trigger: Calling copy_model_version(dst_registry_uri, src_model_uri) with src_model_uri like "/path/to/model", "s3://bucket/model", "runs:/<id>/model", or an http URL instead of "models:/<name>/<version>".

Common situations: Confusing copy_model_version with register/log_model flows that accept other URI schemes; passing a source path from a logged artifact instead of a registered model URI; building URIs by string concatenation that loses the models:/ prefix.

Related errors


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