{"record":{"id":"db6a13f868d84a70","repo":"invoke-ai/InvokeAI","slug":"attempted-migration-of-unsupported-models-yaml-v","errorCode":null,"errorMessage":"Attempted migration of unsupported `models.yaml` v{yaml_version}. Only v3.0.0 is supported. Exiting.","messagePattern":"Attempted migration of unsupported `models\\.yaml` v(.+?)\\. Only v3\\.0\\.0 is supported\\. Exiting\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"invokeai/app/services/model_install/model_install_default.py","lineNumber":703,"sourceCode":"        db_models = self.record_store.all_models()\n\n        legacy_models_yaml_path = (\n            self._app_config.legacy_models_yaml_path or self._app_config.root_path / \"configs\" / \"models.yaml\"\n        )\n\n        # The old path may be relative to the root path\n        if not legacy_models_yaml_path.exists():\n            legacy_models_yaml_path = Path(self._app_config.root_path, legacy_models_yaml_path)\n\n        if legacy_models_yaml_path.exists():\n            with open(legacy_models_yaml_path, \"rt\", encoding=locale.getpreferredencoding()) as file:\n                legacy_models_yaml = yaml.safe_load(file)\n\n            yaml_metadata = legacy_models_yaml.pop(\"__metadata__\")\n            yaml_version = yaml_metadata.get(\"version\")\n\n            if yaml_version != \"3.0.0\":\n                raise ValueError(\n                    f\"Attempted migration of unsupported `models.yaml` v{yaml_version}. Only v3.0.0 is supported. Exiting.\"\n                )\n\n            self._logger.info(\n                f\"Starting one-time migration of {len(legacy_models_yaml.items())} models from {str(legacy_models_yaml_path)}. This may take a few minutes.\"\n            )\n\n            if len(db_models) == 0 and len(legacy_models_yaml.items()) != 0:\n                for model_key, stanza in legacy_models_yaml.items():\n                    _, _, model_name = str(model_key).split(\"/\")\n                    model_path = Path(stanza[\"path\"])\n                    if not model_path.is_absolute():\n                        model_path = self._app_config.models_path / model_path\n                    model_path = model_path.resolve()\n\n                    config = ModelRecordChanges(\n                        name=model_name,\n                        description=stanza.get(\"description\"),","sourceCodeStart":685,"sourceCodeEnd":721,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/services/model_install/model_install_default.py#L685-L721","documentation":"During one-time migration of the legacy models.yaml (invoked from start()), the service requires the file's __metadata__.version to be exactly '3.0.0'. Any other version string raises ValueError telling the user only v3.0.0 is supported for automatic migration.","triggerScenarios":"models.yaml with a version other than '3.0.0' (e.g. v2 edited by hand, or a newer schema) present in the models_path on startup; corrupted or hand-edited __metadata__ block; copying an old models.yaml from a different InvokeAI version.","commonSituations":"Upgrading across several InvokeAI versions so the YAML predates the supported schema; manually editing models.yaml and breaking the version key; mixing config directories from different installs.","solutions":["Update InvokeAI to a version whose migration supports your models.yaml version, or first migrate to v3.0.0 with an intermediate release.","Manually migrate models by re-importing them through the UI/CLI (heuristic_import) into the new database-backed store.","Back up and remove/rename the legacy models.yaml if you no longer need migration, then reinstall models.","Restore __metadata__.version to '3.0.0' only if you are certain the file truly is v3.0.0 and the key was accidentally edited."],"exampleFix":"// before (models.yaml)\n__metadata__:\n  version: 2.0.0\n// after\n# migrate via intermediate InvokeAI release, or remove legacy models.yaml and re-import models via UI/CLI","handlingStrategy":"validation","validationCode":"import yaml\nwith open(models_yaml_path) as f:\n    meta = yaml.safe_load(f).get('__metadata__', {})\nif meta.get('version') != '3.0.0':\n    raise SystemExit(f'Legacy models.yaml is v{meta.get(\"version\")}; migrate to v3.0.0 first')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-edit __metadata__.version in models.yaml.","When upgrading multiple InvokeAI versions, go through intermediate releases so migration runs at each supported step.","Back up models.yaml before startup upgrades.","Prefer importing models into the new DB store via UI/CLI rather than legacy YAML."],"tags":["migration","config","startup"],"backgroundTag":"unsupported-schema-version","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}