{"record":{"id":"832367fe6343da56","repo":"invoke-ai/InvokeAI","slug":"expected-main-gguf-qwenimage-config-got-type-con","errorCode":null,"errorMessage":"Expected Main_GGUF_QwenImage_Config, got {type(config).__name__}.","messagePattern":"Expected Main_GGUF_QwenImage_Config, got (.+?)\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/load/model_loaders/qwen_image.py","lineNumber":206,"sourceCode":"        config: AnyModelConfig,\n        submodel_type: Optional[SubModelType] = None,\n    ) -> AnyModel:\n        if not isinstance(config, Checkpoint_Config_Base):\n            raise ValueError(\"Only CheckpointConfigBase models are currently supported here.\")\n\n        match submodel_type:\n            case SubModelType.Transformer:\n                return self._load_from_singlefile(config)\n\n        raise ValueError(\n            f\"Only Transformer submodels are currently supported. Received: {submodel_type.value if submodel_type else 'None'}\"\n        )\n\n    def _load_from_singlefile(self, config: AnyModelConfig) -> AnyModel:\n        from diffusers import QwenImageTransformer2DModel\n\n        if not isinstance(config, Main_GGUF_QwenImage_Config):\n            raise TypeError(f\"Expected Main_GGUF_QwenImage_Config, got {type(config).__name__}.\")\n        model_path = Path(config.path)\n\n        target_device = TorchDevice.choose_torch_device()\n        compute_dtype = TorchDevice.choose_bfloat16_safe_dtype(target_device)\n\n        sd = gguf_sd_loader(model_path, compute_dtype=compute_dtype)\n        sd = _strip_comfyui_prefix(sd)\n\n        is_edit = getattr(config, \"variant\", None) == QwenImageVariantType.Edit\n        model_config = _build_qwen_image_transformer_config(sd, is_edit=is_edit)\n\n        with accelerate.init_empty_weights():\n            model = QwenImageTransformer2DModel(**model_config)\n\n        model.load_state_dict(sd, strict=False, assign=True)\n        return model\n\n","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/load/model_loaders/qwen_image.py#L188-L224","documentation":"The GGUF single-file loader path requires the config to be exactly Main_GGUF_QwenImage_Config (GGUF quantized Qwen Image checkpoint). Any other config type (regular safetensors checkpoint, diffusers config) reaches _load_from_singlefile and raises this TypeError, naming the actual config type received.","triggerScenarios":"A model whose config is Main_Checkpoint_QwenImage_Config (safetensors single-file) or another type routed into the GGUF loader's _load_from_singlefile, typically via wrong registry/format resolution.","commonSituations":"GGUF model file registered with the safetensors checkpoint format; mixed-up model entries after manual import; version drift where new GGUF config classes were added but the model entry predates them.","solutions":["Re-scan/re-convert the model so GGUF files are registered with Main_GGUF_QwenImage_Config (ModelFormat.GGUFQuantized).","If the model is a plain safetensors checkpoint, ensure it routes to the non-GGUF checkpoint loader instead.","Check the model's config class in the model manager records and fix the format field on the model record."],"exampleFix":"// before\nconfig = Main_Checkpoint_QwenImage_Config(path=\"model.safetensors\")\nmodel = gguf_loader._load_from_singlefile(config)\n// after\nconfig = Main_GGUF_QwenImage_Config(path=\"model.gguf\")\nmodel = gguf_loader._load_from_singlefile(config)","handlingStrategy":"type-guard","validationCode":"from invokeai.backend.model_manager.config import Main_GGUF_QwenImage_Config\nif not isinstance(config, Main_GGUF_QwenImage_Config):\n    raise TypeError(f\"GGUF loader needs Main_GGUF_QwenImage_Config, got {type(config).__name__}\")","typeGuard":"def is_gguf_qwen_config(config: AnyModelConfig) -> bool:\n    return isinstance(config, Main_GGUF_QwenImage_Config)","tryCatchPattern":"try:\n    model = gguf_loader._load_from_singlefile(config)\nexcept TypeError as e:\n    if \"Main_GGUF_QwenImage_Config\" in str(e):\n        config = reregister_model(path, ModelFormat.GGUFQuantized)\n        model = gguf_loader._load_from_singlefile(config)\n    else:\n        raise","preventionTips":["Register .gguf files with ModelFormat.GGUFQuantized","Verify the config class in the model record matches the file extension","Re-scan after upgrading InvokeAI to pick up new GGUF config classes"],"tags":["model-loader","invokeai","gguf","config-type"],"backgroundTag":"invalid-config-type","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}