{"record":{"id":"5572543d3055dea9","repo":"invoke-ai/InvokeAI","slug":"only-qwen3encoder-gguf-config-models-are-supported","errorCode":null,"errorMessage":"Only Qwen3Encoder_GGUF_Config models are supported here.","messagePattern":"Only Qwen3Encoder_GGUF_Config models are supported here\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/load/model_loaders/z_image.py","lineNumber":1167,"sourceCode":"                    parent.register_buffer(buffer_name, inv_freq.to(model_dtype), persistent=False)\n                else:\n                    # For other buffers, log warning\n                    logger.warning(f\"Re-initializing unknown meta buffer: {name}\")\n\n        return model\n\n\n@ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.Qwen3Encoder, format=ModelFormat.GGUFQuantized)\nclass Qwen3EncoderGGUFLoader(ModelLoader):\n    \"\"\"Class to load GGUF-quantized Qwen3 Encoder models for Z-Image.\"\"\"\n\n    def _load_model(\n        self,\n        config: AnyModelConfig,\n        submodel_type: Optional[SubModelType] = None,\n    ) -> AnyModel:\n        if not isinstance(config, Qwen3Encoder_GGUF_Config):\n            raise ValueError(\"Only Qwen3Encoder_GGUF_Config models are supported here.\")\n\n        match submodel_type:\n            case SubModelType.TextEncoder:\n                return self._load_from_gguf(config)\n            case SubModelType.Tokenizer:\n                # GGUF checkpoints ship no tokenizer files; use the vendored copy.\n                return self._load_bundled_tokenizer()\n\n        raise ValueError(\n            f\"Only TextEncoder and Tokenizer submodels are supported. Received: {submodel_type.value if submodel_type else 'None'}\"\n        )\n\n    def _load_bundled_tokenizer(self) -> AnyModel:\n        \"\"\"Load the Qwen3 tokenizer from the vendored, bundled copy.\n\n        Single-file / GGUF checkpoints do not ship tokenizer files. The Qwen3 BPE\n        tokenizer is identical across the 0.6B / 4B / 8B variants, so we load the\n        self-contained copy vendored in the package — fully offline, no HuggingFace","sourceCodeStart":1149,"sourceCodeEnd":1185,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/load/model_loaders/z_image.py#L1149-L1185","documentation":"The Z-Image GGUF text-encoder loader only accepts Qwen3Encoder_GGUF_Config instances. A config of any other type cannot provide the GGUF file path or quantization metadata the loader needs, so _load_model raises this ValueError before attempting any load.","triggerScenarios":"GGUF loader dispatched with a checkpoint-format config (Qwen3Encoder_Checkpoint_Config or generic), or a script calls _load_model with a manually built config that is not Qwen3Encoder_GGUF_Config.","commonSituations":"Model file is GGUF but the record was registered as single-file checkpoint; user swapped the file extension/format after registration without re-scanning; custom automation passing configs between the checkpoint and GGUF loaders.","solutions":["Re-register the model as GGUF format so InvokeAI creates a Qwen3Encoder_GGUF_Config for it.","If the file is actually a plain safetensors checkpoint, use the checkpoint loader (error index 1332 path) instead.","Construct a Qwen3Encoder_GGUF_Config explicitly when calling the loader programmatically.","Check the model's format field in the model manager and correct it to match the on-disk file."],"exampleFix":"// before (checkpoint config reaching GGUF loader)\nconfig = Qwen3Encoder_Checkpoint_Config(path=\"encoder.gguf\")\n// after\nconfig = Qwen3Encoder_GGUF_Config(path=\"encoder.gguf\")\nloader._load_model(config, submodel_type=SubModelType.TextEncoder)","handlingStrategy":"type-guard","validationCode":"if not isinstance(config, Qwen3Encoder_GGUF_Config):\n    raise TypeError(f\"GGUF loader needs Qwen3Encoder_GGUF_Config, got {type(config).__name__}\")","typeGuard":"def is_qwen3_gguf_config(config: AnyModelConfig) -> bool:\n    return isinstance(config, Qwen3Encoder_GGUF_Config)","tryCatchPattern":"try:\n    model = loader._load_model(config, submodel_type)\nexcept ValueError as e:\n    if \"Qwen3Encoder_GGUF_Config\" in str(e):\n        config = re_register_model_as_gguf(model_id)\n        model = loader._load_model(config, submodel_type)\n    else:\n        raise","preventionTips":["Register GGUF files with format=GGUF so the GGUF config class is created.","Don't reuse checkpoint configs for GGUF files after swapping files.","Re-scan the model directory after changing file formats.","Verify the file magic/extension before choosing a loader."],"tags":["invokeai","z-image","gguf","qwen3","config-type-mismatch"],"backgroundTag":"model-config-type-mismatch","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}