{"record":{"id":"d6e5ff4d294eb90b","repo":"invoke-ai/InvokeAI","slug":"expected-qwenvlencoder-checkpoint-config-got-typ","errorCode":null,"errorMessage":"Expected QwenVLEncoder_Checkpoint_Config, got {type(config).__name__}.","messagePattern":"Expected QwenVLEncoder_Checkpoint_Config, got (.+?)\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/load/model_loaders/qwen_image.py","lineNumber":347,"sourceCode":"\n@ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.QwenVLEncoder, format=ModelFormat.Checkpoint)\nclass QwenVLEncoderCheckpointLoader(ModelLoader):\n    \"\"\"Loads a single-file Qwen2.5-VL encoder checkpoint (e.g. ComfyUI fp8_scaled).\n\n    The checkpoint bundles the language model and the visual tower into one\n    safetensors file. Tokenizer + processor are pulled from HuggingFace\n    (`Qwen/Qwen2.5-VL-7B-Instruct`) on first use, with offline cache fallback.\n    \"\"\"\n\n    DEFAULT_HF_REPO = \"Qwen/Qwen2.5-VL-7B-Instruct\"\n\n    def _load_model(\n        self,\n        config: AnyModelConfig,\n        submodel_type: Optional[SubModelType] = None,\n    ) -> AnyModel:\n        if not isinstance(config, QwenVLEncoder_Checkpoint_Config):\n            raise TypeError(f\"Expected QwenVLEncoder_Checkpoint_Config, got {type(config).__name__}.\")\n\n        match submodel_type:\n            case SubModelType.Tokenizer:\n                return self._load_tokenizer_with_offline_fallback()\n            case SubModelType.TextEncoder:\n                return self._load_text_encoder_from_singlefile(config)\n\n        raise ValueError(\n            f\"Only Tokenizer and TextEncoder submodels are supported. \"\n            f\"Received: {submodel_type.value if submodel_type else 'None'}\"\n        )\n\n    def _load_tokenizer_with_offline_fallback(self) -> AnyModel:\n        from transformers import AutoTokenizer\n\n        from invokeai.backend.util.logging import InvokeAILogger\n\n        logger = InvokeAILogger.get_logger(self.__class__.__name__)","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/load/model_loaders/qwen_image.py#L329-L365","documentation":"The checkpoint-format Qwen VL encoder loader only accepts QwenVLEncoder_Checkpoint_Config. Any other config type reaching its _load_model raises this TypeError naming the actual type, because its helpers load tokenizer/text-encoder weights from a single checkpoint file rather than a diffusers folder.","triggerScenarios":"Passing a QwenVLEncoder_Diffusers_Config (or any other config) into the checkpoint-registered loader's _load_model, e.g. via a model record whose format says checkpoint but whose config is diffusers-derived.","commonSituations":"Model record format/config mismatch after import; diffusers-folder encoder incorrectly registered as checkpoint; scripts constructing the wrong config class.","solutions":["Use QwenVLEncoder_Checkpoint_Config when calling this loader, with path pointing at the single checkpoint file.","If the model is a diffusers folder, route it to the diffusers-registered QwenVLEncoder loader.","Re-scan or edit the model record so format and config class agree with the on-disk layout."],"exampleFix":"// before\nconfig = QwenVLEncoder_Diffusers_Config(path=\"encoder_dir/\")\nenc = checkpoint_loader._load_model(config, SubModelType.TextEncoder)\n// after\nconfig = QwenVLEncoder_Checkpoint_Config(path=\"encoder.safetensors\")\nenc = checkpoint_loader._load_model(config, SubModelType.TextEncoder)","handlingStrategy":"type-guard","validationCode":"from invokeai.backend.model_manager.config import QwenVLEncoder_Checkpoint_Config\nif not isinstance(config, QwenVLEncoder_Checkpoint_Config):\n    raise TypeError(f\"Checkpoint QwenVL loader needs QwenVLEncoder_Checkpoint_Config, got {type(config).__name__}\")","typeGuard":"def is_checkpoint_qwenvl_config(config: AnyModelConfig) -> bool:\n    return isinstance(config, QwenVLEncoder_Checkpoint_Config)","tryCatchPattern":"try:\n    enc = loader._load_model(config, SubModelType.TextEncoder)\nexcept TypeError as e:\n    if \"QwenVLEncoder_Checkpoint_Config\" in str(e):\n        enc = diffusers_qwenvl_loader._load_model(config, SubModelType.TextEncoder)\n    else:\n        raise","preventionTips":["Ensure checkpoint-format encoders use QwenVLEncoder_Checkpoint_Config","Point the config path at the single checkpoint file, not a folder","Keep format and config class consistent in model records"],"tags":["model-loader","invokeai","qwen-vl","checkpoint","config-type"],"backgroundTag":"invalid-config-type","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}