{"record":{"id":"e4ba2bffa4a87c2d","repo":"mlflow/mlflow","slug":"model-version-creation-error-name-name-giving","errorCode":null,"errorMessage":"Model Version creation error (name={name}). Giving up after {CREATE_MODEL_VERSION_RETRIES} attempts.","messagePattern":"Model Version creation error \\(name=(.+?)\\)\\. Giving up after (.+?) attempts\\.","errorType":"exception","errorClass":"MlflowException","httpStatus":null,"severity":"error","filePath":"mlflow/store/model_registry/sqlalchemy_store.py","lineNumber":1093,"sourceCode":"                            SqlModelVersionTag(name=name, version=version, key=key, value=value)\n                        )\n                        for key, value in tags_dict.items()\n                    ]\n                    session.add_all([sql_registered_model, model_version])\n                    session.flush()\n                    return self._populate_model_version_aliases(\n                        session, name, model_version.to_mlflow_entity()\n                    )\n                except sqlalchemy.exc.IntegrityError:\n                    session.rollback()\n                    more_retries = self.CREATE_MODEL_VERSION_RETRIES - attempt - 1\n                    _logger.info(\n                        \"Model Version creation error (name=%s) Retrying %s more time%s.\",\n                        name,\n                        str(more_retries),\n                        \"s\" if more_retries > 1 else \"\",\n                    )\n        raise MlflowException(\n            f\"Model Version creation error (name={name}). Giving up after \"\n            f\"{self.CREATE_MODEL_VERSION_RETRIES} attempts.\"\n        )\n\n    def _populate_model_version_aliases(self, session, name, version):\n        model_aliases = self._get_registered_model(session, name).registered_model_aliases\n        version.aliases = [\n            alias.alias for alias in model_aliases if alias.version == version.version\n        ]\n        return version\n\n    def _get_model_version_from_db(self, session, name, version, conditions, query_options=None):\n        if query_options is None:\n            query_options = []\n        versions = (\n            self\n            ._get_query(session, SqlModelVersion)\n            .options(*query_options)","sourceCodeStart":1075,"sourceCodeEnd":1111,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/store/model_registry/sqlalchemy_store.py#L1075-L1111","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the logged root-cause exception from the last retry attempt (check server/client logs) and fix that underlying failure first.","Verify artifact storage credentials and reachability (e.g., AWS/GCP/Azure auth) before retrying.","Reduce concurrency on the same registered model or retry later to avoid DB lock contention.","Increase CREATE_MODEL_VERSION_RETRIES if failures are transient and frequent.","Ensure the registered model exists (create_registered_model) and the database is healthy."],"exampleFix":"// before: retry loop failing on transient storage outage\nmv = client.create_model_version(name=\"m\", source=\"s3://bucket/run\")\n// after: validate artifact access and model existence first\nclient.get_registered_model(\"m\")  # raises early if model missing\nassert_valid_s3_credentials()\nmv = client.create_model_version(name=\"m\", source=\"s3://bucket/run\")","handlingStrategy":"retry","validationCode":"from mlflow.tracking import MlflowException\nclient = MlflowClient()\nclient.get_registered_model(name)  # fail fast if model missing\n# verify artifact source is reachable before creating the version","typeGuard":null,"tryCatchPattern":"from mlflow.tracking import MlflowException\nfrom mlflow.exceptions import MlflowException as ME\ntry:\n    mv = client.create_model_version(name=name, source=src)\nexcept ME as e:\n    logger.error(\"Model version creation failed after retries: %s\", e)\n    raise","preventionTips":["Verify storage credentials and source URI accessibility before creating versions","Avoid many concurrent create_model_version calls against the same registered model","Read the retried root-cause exceptions in logs to fix the underlying failure","Keep the tracking database healthy and connection pools sized properly"],"tags":["model-registry","retry-exhausted","database","sqlalchemy"],"backgroundTag":"retry-attempts-exhausted","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}