invoke-ai/InvokeAI · error · ValueError

Only Qwen3Encoder_SDNQ_Config or Qwen3Encoder_SDNQ_Folder_Co

Error message

Only Qwen3Encoder_SDNQ_Config or Qwen3Encoder_SDNQ_Folder_Config models are supported here.

What it means

The Z-Image SDNQ loader's _load_model entry point only accepts Qwen3Encoder_SDNQ_Config or Qwen3Encoder_SDNQ_Folder_Config model configs. Passing any other config type (different model family or loader) raises this ValueError at dispatch time.

Source

Thrown at invokeai/backend/model_manager/load/model_loaders/z_image.py:1469

                new_sd[key] = value

        return new_sd


@ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.Qwen3Encoder, format=ModelFormat.SDNQQuantized)
class Qwen3EncoderSDNQLoader(ModelLoader):
    """Class to load SDNQ-quantized Qwen3 Encoder models for Z-Image."""

    # Default HuggingFace model to load tokenizer from when using SDNQ Qwen3 encoder
    DEFAULT_TOKENIZER_SOURCE = "Qwen/Qwen3-4B"

    def _load_model(
        self,
        config: AnyModelConfig,
        submodel_type: Optional[SubModelType] = None,
    ) -> AnyModel:
        if not isinstance(config, (Qwen3Encoder_SDNQ_Config, Qwen3Encoder_SDNQ_Folder_Config)):
            raise ValueError(
                "Only Qwen3Encoder_SDNQ_Config or Qwen3Encoder_SDNQ_Folder_Config models are supported here."
            )

        match submodel_type:
            case SubModelType.TextEncoder:
                return self._load_from_sdnq(config)
            case SubModelType.Tokenizer:
                return self._load_tokenizer_with_offline_fallback()

        submodel_str = submodel_type.value if submodel_type else "None"
        raise ValueError(f"Only TextEncoder and Tokenizer submodels are supported. Received: {submodel_str}")

    def _load_tokenizer_with_offline_fallback(self) -> AnyModel:
        """Load tokenizer with local_files_only fallback for offline support."""
        try:
            return AutoTokenizer.from_pretrained(self.DEFAULT_TOKENIZER_SOURCE, local_files_only=True)
        except OSError:
            return AutoTokenizer.from_pretrained(self.DEFAULT_TOKENIZER_SOURCE)

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Confirm the model was imported so its config is Qwen3Encoder_SDNQ_Config or Qwen3Encoder_SDNQ_Folder_Config (check the models.yaml / DB record type field).
  2. Re-import the model through the UI/CLI so the correct config class and loader are matched.
  3. If you support a new SDNQ config type, add it to the isinstance tuple in _load_model.
  4. Verify you did not accidentally install the SDNQ file under the Z-Image model root when it belongs to another model family.

Example fix

// before: wrong loader for config
loader._load_model(NonSDNQConfig(path=...))
// after
cfg = Qwen3Encoder_SDNQ_Folder_Config(path=...)
loader._load_model(cfg, SubModelType.TextEncoder)
Defensive patterns

Strategy: type-guard

Validate before calling

from invokeai.backend.model_manager.load.model_loaders.z_image import (
    Qwen3Encoder_SDNQ_Config, Qwen3Encoder_SDNQ_Folder_Config)
if not isinstance(cfg, (Qwen3Encoder_SDNQ_Config, Qwen3Encoder_SDNQ_Folder_Config)):
    raise TypeError(f"Z-Image SDNQ loader requires an SDNQ Qwen3 config, got {type(cfg).__name__}")

Type guard

def is_sdnq_qwen3_config(cfg: AnyModelConfig) -> bool:
    from invokeai.backend.model_manager.load.model_loaders.z_image import (
        Qwen3Encoder_SDNQ_Config, Qwen3Encoder_SDNQ_Folder_Config)
    return isinstance(cfg, (Qwen3Encoder_SDNQ_Config, Qwen3Encoder_SDNQ_Folder_Config))

Try / catch

try:
    model = loader._load_model(cfg, SubModelType.TextEncoder)
except ValueError as e:
    if "Only Qwen3Encoder_SDNQ" in str(e):
        raise UnsupportedModelTypeError(type(cfg).__name__) from e
    raise

Prevention

When it happens

Trigger: Registering/invoking the Z-Image SDNQ loader with a config that is not one of the two supported SDNQ config classes — e.g. a plain ModelConfigBase, a GGUF config, or a checkpoint config routed to this loader by a miswritten model-import or custom node.

Common situations: Custom model-install code choosing the wrong loader; config class added by a fork/patch but not updated in _load_model's isinstance check; user placed an SDNQ model of the wrong family in the Z-Image text-encoder directory.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/080539aad6094438. Report an issue: GitHub.