mlflow/mlflow · error · MlflowException

Model Version creation error (name={name}). Giving up after

Error message

Model Version creation error (name={name}). Giving up after {CREATE_MODEL_VERSION_RETRIES} attempts.

What it means

MLflow retries creating a model version (CREATE_MODEL_VERSION_RETRIES times) when transient failures occur during creation. If every attempt fails, it raises this MlflowException indicating the model version could not be created after exhausting all retries.

Source

Thrown at mlflow/store/model_registry/sqlalchemy_store.py:1093

                            SqlModelVersionTag(name=name, version=version, key=key, value=value)
                        )
                        for key, value in tags_dict.items()
                    ]
                    session.add_all([sql_registered_model, model_version])
                    session.flush()
                    return self._populate_model_version_aliases(
                        session, name, model_version.to_mlflow_entity()
                    )
                except sqlalchemy.exc.IntegrityError:
                    session.rollback()
                    more_retries = self.CREATE_MODEL_VERSION_RETRIES - attempt - 1
                    _logger.info(
                        "Model Version creation error (name=%s) Retrying %s more time%s.",
                        name,
                        str(more_retries),
                        "s" if more_retries > 1 else "",
                    )
        raise MlflowException(
            f"Model Version creation error (name={name}). Giving up after "
            f"{self.CREATE_MODEL_VERSION_RETRIES} attempts."
        )

    def _populate_model_version_aliases(self, session, name, version):
        model_aliases = self._get_registered_model(session, name).registered_model_aliases
        version.aliases = [
            alias.alias for alias in model_aliases if alias.version == version.version
        ]
        return version

    def _get_model_version_from_db(self, session, name, version, conditions, query_options=None):
        if query_options is None:
            query_options = []
        versions = (
            self
            ._get_query(session, SqlModelVersion)
            .options(*query_options)

View on GitHub (pinned to 6a27f2decc)

Solutions

  1. Inspect the logged root-cause exception from the last retry attempt (check server/client logs) and fix that underlying failure first.
  2. Verify artifact storage credentials and reachability (e.g., AWS/GCP/Azure auth) before retrying.
  3. Reduce concurrency on the same registered model or retry later to avoid DB lock contention.
  4. Increase CREATE_MODEL_VERSION_RETRIES if failures are transient and frequent.
  5. Ensure the registered model exists (create_registered_model) and the database is healthy.

Example fix

// before: retry loop failing on transient storage outage
mv = client.create_model_version(name="m", source="s3://bucket/run")
// after: validate artifact access and model existence first
client.get_registered_model("m")  # raises early if model missing
assert_valid_s3_credentials()
mv = client.create_model_version(name="m", source="s3://bucket/run")
Defensive patterns

Strategy: retry

Validate before calling

from mlflow.tracking import MlflowException
client = MlflowClient()
client.get_registered_model(name)  # fail fast if model missing
# verify artifact source is reachable before creating the version

Try / catch

from mlflow.tracking import MlflowException
from mlflow.exceptions import MlflowException as ME
try:
    mv = client.create_model_version(name=name, source=src)
except ME as e:
    logger.error("Model version creation failed after retries: %s", e)
    raise

Prevention

When it happens

Trigger: Calling create_model_version (directly or via client.create_model_version / mlflow.<flavor>.log_model with a registered model) when each attempt hits an underlying failure such as DB errors, artifact upload failures, or lock/wait timeouts on the registered model row.

Common situations: Concurrent model version creation on the same registered model causing DB contention; a broken artifact repository (bad S3/GCS/Azure credentials or unreachable storage); database connectivity issues; overly restrictive wait timeouts under heavy load.

Related errors


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