{"record":{"id":"88d4bd199815884f","repo":"invoke-ai/InvokeAI","slug":"only-qwen3vlencoder-checkpoint-config-models-are-s","errorCode":null,"errorMessage":"Only Qwen3VLEncoder_Checkpoint_Config models are supported here.","messagePattern":"Only Qwen3VLEncoder_Checkpoint_Config models are supported here\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/load/model_loaders/krea2.py","lineNumber":544,"sourceCode":"\n@ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.Qwen3VLEncoder, format=ModelFormat.Checkpoint)\nclass Qwen3VLEncoderCheckpointLoader(ModelLoader):\n    \"\"\"Loads a single-file Qwen3-VL encoder checkpoint (e.g. ComfyUI ``qwen3vl_4b_bf16`` / ``_fp8_scaled``).\n\n    The checkpoint bundles the language model + visual tower but no config/tokenizer; those are pulled\n    from HuggingFace (``Qwen/Qwen3-VL-4B-Instruct``) with offline-cache fallback. ComfyUI 'scaled fp8'\n    weights are dequantized to the compute dtype on load.\n    \"\"\"\n\n    DEFAULT_HF_REPO = \"Qwen/Qwen3-VL-4B-Instruct\"\n\n    def _load_model(\n        self,\n        config: AnyModelConfig,\n        submodel_type: Optional[SubModelType] = None,\n    ) -> AnyModel:\n        if not isinstance(config, Qwen3VLEncoder_Checkpoint_Config):\n            raise ValueError(\"Only Qwen3VLEncoder_Checkpoint_Config models are supported here.\")\n\n        match submodel_type:\n            case SubModelType.Tokenizer:\n                return self._load_tokenizer()\n            case SubModelType.TextEncoder:\n                return self._load_text_encoder(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(self) -> AnyModel:\n        # A partial offline cache (e.g. config present but vocab/merges missing) raises something other\n        # than OSError (e.g. TypeError) deep in the slow-tokenizer path, so catch broadly and re-fetch.\n        try:\n            return AutoTokenizer.from_pretrained(self.DEFAULT_HF_REPO, local_files_only=True, extra_special_tokens={})\n        except Exception:","sourceCodeStart":526,"sourceCodeEnd":562,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/load/model_loaders/krea2.py#L526-L562","documentation":"This ValueError is thrown by Krea2ModelLoader._load_model when the model config passed to it is not a Qwen3VLEncoder_Checkpoint_Config instance. The loader only knows how to load Krea2's Qwen3VL text-encoder checkpoint assets, so any other config type is rejected up front before any submodel dispatch. It is an internal contract violation: the model manager routed a model to this loader that does not match its expected config schema.","triggerScenarios":"Calling ModelManager load with a Krea2 text-encoder entry whose config record was created as a different checkpoint config class (e.g. a generic CheckpointConfig or another family's config) instead of Qwen3VLEncoder_Checkpoint_Config; a model-install/convert path that wrote the wrong config wrapper to the DB; hand-edited model config records.","commonSituations":"Installing a Krea2 model from a folder whose config was imported incorrectly; migrating models between InvokeAI versions where the Krea2 config class changed; custom scripts that construct AnyModelConfig objects manually for Krea2 text encoders.","solutions":["Reinstall the Krea2 text-encoder model through the InvokeAI model manager UI/CLI so the correct Qwen3VLEncoder_Checkpoint_Config record is created.","Check the model's config record in the DB/config file and ensure its type field maps to Qwen3VLEncoder_Checkpoint_Config for the Krea2 base model.","Update InvokeAI to the latest version; older installs may have written a legacy config type that this loader no longer accepts.","If writing custom code, instantiate Qwen3VLEncoder_Checkpoint_Config (not a generic config) for the Krea2 text encoder before loading."],"exampleFix":"// before\nconfig = CheckpointConfig(path=..., ...)  # generic config\nmodel = loader._load_model(config, SubModelType.TextEncoder)  # raises\n// after\nfrom invokeai.backend.model_manager.configs.krea2 import Qwen3VLEncoder_Checkpoint_Config\nconfig = Qwen3VLEncoder_Checkpoint_Config(path=..., ...)  # exact config class\nmodel = loader._load_model(config, SubModelType.TextEncoder)","handlingStrategy":"type-guard","validationCode":"from invokeai.backend.model_manager.configs.krea2 import Qwen3VLEncoder_Checkpoint_Config\nif not isinstance(config, Qwen3VLEncoder_Checkpoint_Config):\n    raise TypeError(f\"Expected Qwen3VLEncoder_Checkpoint_Config, got {type(config).__name__}\")","typeGuard":"def is_qwen3vl_config(config: AnyModelConfig) -> bool:\n    return isinstance(config, Qwen3VLEncoder_Checkpoint_Config)","tryCatchPattern":"try:\n    model = loader._load_model(config, submodel_type)\nexcept ValueError as e:\n    if 'Qwen3VLEncoder_Checkpoint_Config' in str(e):\n        # reinstall the model record or use the correct loader/key\n        log.error(f\"Wrong config type for Krea2 loader: {type(config).__name__}\")\n    else:\n        raise","preventionTips":["Always install Krea2 models through the InvokeAI model manager so config records are created with the right class.","Never construct AnyModelConfig subclasses by hand for Krea2; use ModelRecordBase.make_config or the install API.","Assert the config type before calling low-level loader methods directly.","Keep InvokeAI updated so config schema changes are migrated automatically."],"tags":["python","valueerror","model-loader","invokeai","config-mismatch"],"backgroundTag":"model-config-type-mismatch","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}