{"record":{"id":"b02b0af68488e1f8","repo":"invoke-ai/InvokeAI","slug":"base-is-recognized-base-not-expected-base-b02b0a","errorCode":null,"errorMessage":"base is {recognized_base}, not {expected_base}","messagePattern":"base is (.+?), not (.+?)","errorType":"exception","errorClass":"NotAMatchError","httpStatus":null,"severity":"info","filePath":"invokeai/backend/model_manager/configs/main.py","lineNumber":367,"sourceCode":"        cls._validate_looks_like_main_model(mod)\n\n        cls._validate_base(mod)\n\n        prediction_type = override_fields.pop(\"prediction_type\", None) or cls._get_scheduler_prediction_type_or_raise(\n            mod\n        )\n\n        variant = override_fields.pop(\"variant\", None) or cls._get_variant_or_raise(mod)\n\n        return cls(**override_fields, prediction_type=prediction_type, variant=variant)\n\n    @classmethod\n    def _validate_base(cls, mod: ModelOnDisk) -> None:\n        \"\"\"Raise `NotAMatch` if the model base does not match this config class.\"\"\"\n        expected_base = cls.model_fields[\"base\"].default\n        recognized_base = cls._get_base_or_raise(mod)\n        if expected_base is not recognized_base:\n            raise NotAMatchError(f\"base is {recognized_base}, not {expected_base}\")\n\n    @classmethod\n    def _get_base_or_raise(cls, mod: ModelOnDisk) -> BaseModelType:\n        state_dict = mod.load_state_dict()\n\n        key_name = \"model.diffusion_model.input_blocks.2.1.transformer_blocks.0.attn2.to_k.weight\"\n        if key_name in state_dict and state_dict[key_name].shape[-1] == 768:\n            return BaseModelType.StableDiffusion1\n        if key_name in state_dict and state_dict[key_name].shape[-1] == 1024:\n            return BaseModelType.StableDiffusion2\n\n        key_name = \"model.diffusion_model.input_blocks.4.1.transformer_blocks.0.attn2.to_k.weight\"\n        if key_name in state_dict and state_dict[key_name].shape[-1] == 2048:\n            return BaseModelType.StableDiffusionXL\n        elif key_name in state_dict and state_dict[key_name].shape[-1] == 1280:\n            return BaseModelType.StableDiffusionXLRefiner\n\n        raise NotAMatchError(\"unable to determine base type from state dict\")","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/main.py#L349-L385","documentation":"Each main-model config class declares an expected base (e.g. SD1) and validates by calling its _get_base_or_raise on the state dict. If the probed base differs from the class's default base, from_model_on_disk raises NotAMatchError stating 'base is X, not Y'. This is part of the normal probe chain: it signals the model belongs to a different config class.","triggerScenarios":"Scanning a checkpoint whose detected base (from distinguishing keys like input_blocks attn2.to_k shapes) does not equal the config class default, e.g. an SD2 checkpoint being validated by Main_Checkpoint_SD1_Config.","commonSituations":"Importing SDXL/SD2 checkpoints into an older InvokeAI that lacks the matching config class; overrides forcing the wrong config family; miscategorized model folders.","solutions":["Let the full probe chain run — this error from one class is expected when another class matches; ensure your InvokeAI version includes configs for the model's actual base.","If you force base via override fields, make it match the checkpoint's true architecture.","Verify the checkpoint is what you think it is (check attn2.to_k weight shapes: 768=SD1, 1024=SD2, 2048=SDXL).","Update InvokeAI to the latest version to gain config classes for newer bases."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    cfg = Main_Checkpoint_SD1_Config.from_model_on_disk(mod)\nexcept NotAMatchError as e:\n    log.info('Not SD1 (%s); trying next config class', e)\n    cfg = None","preventionTips":["Rely on the probe chain / generic scan API instead of a specific config class","Keep InvokeAI updated so all base config classes exist","Verify checkpoint architecture before forcing base overrides"],"tags":["checkpoint","base-model","model-probe"],"backgroundTag":"model-base-mismatch","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}