invoke-ai/InvokeAI · error · ValueError

Only Qwen3VLEncoder_Checkpoint_Config models are supported h

Error message

Only Qwen3VLEncoder_Checkpoint_Config models are supported here.

What it means

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.

Source

Thrown at invokeai/backend/model_manager/load/model_loaders/krea2.py:544

@ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.Qwen3VLEncoder, format=ModelFormat.Checkpoint)
class Qwen3VLEncoderCheckpointLoader(ModelLoader):
    """Loads a single-file Qwen3-VL encoder checkpoint (e.g. ComfyUI ``qwen3vl_4b_bf16`` / ``_fp8_scaled``).

    The checkpoint bundles the language model + visual tower but no config/tokenizer; those are pulled
    from HuggingFace (``Qwen/Qwen3-VL-4B-Instruct``) with offline-cache fallback. ComfyUI 'scaled fp8'
    weights are dequantized to the compute dtype on load.
    """

    DEFAULT_HF_REPO = "Qwen/Qwen3-VL-4B-Instruct"

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

        match submodel_type:
            case SubModelType.Tokenizer:
                return self._load_tokenizer()
            case SubModelType.TextEncoder:
                return self._load_text_encoder(config)

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

    def _load_tokenizer(self) -> AnyModel:
        # A partial offline cache (e.g. config present but vocab/merges missing) raises something other
        # than OSError (e.g. TypeError) deep in the slow-tokenizer path, so catch broadly and re-fetch.
        try:
            return AutoTokenizer.from_pretrained(self.DEFAULT_HF_REPO, local_files_only=True, extra_special_tokens={})
        except Exception:

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Reinstall the Krea2 text-encoder model through the InvokeAI model manager UI/CLI so the correct Qwen3VLEncoder_Checkpoint_Config record is created.
  2. 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.
  3. Update InvokeAI to the latest version; older installs may have written a legacy config type that this loader no longer accepts.
  4. If writing custom code, instantiate Qwen3VLEncoder_Checkpoint_Config (not a generic config) for the Krea2 text encoder before loading.

Example fix

// before
config = CheckpointConfig(path=..., ...)  # generic config
model = loader._load_model(config, SubModelType.TextEncoder)  # raises
// after
from invokeai.backend.model_manager.configs.krea2 import Qwen3VLEncoder_Checkpoint_Config
config = Qwen3VLEncoder_Checkpoint_Config(path=..., ...)  # exact config class
model = loader._load_model(config, SubModelType.TextEncoder)
Defensive patterns

Strategy: type-guard

Validate before calling

from invokeai.backend.model_manager.configs.krea2 import Qwen3VLEncoder_Checkpoint_Config
if not isinstance(config, Qwen3VLEncoder_Checkpoint_Config):
    raise TypeError(f"Expected Qwen3VLEncoder_Checkpoint_Config, got {type(config).__name__}")

Type guard

def is_qwen3vl_config(config: AnyModelConfig) -> bool:
    return isinstance(config, Qwen3VLEncoder_Checkpoint_Config)

Try / catch

try:
    model = loader._load_model(config, submodel_type)
except ValueError as e:
    if 'Qwen3VLEncoder_Checkpoint_Config' in str(e):
        # reinstall the model record or use the correct loader/key
        log.error(f"Wrong config type for Krea2 loader: {type(config).__name__}")
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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