invoke-ai/InvokeAI · error · NotAMatchError

missing {config_path}

Error message

missing {config_path}

What it means

`NotAMatchError` with `missing {config_path}` means the `text_encoder/config.json` file does not exist inside the model directory. `from_model_on_disk` reads this JSON to identify the encoder class; with no config file the directory cannot be recognized as a Qwen VL text encoder, so the config class declines the match.

Source

Thrown at invokeai/backend/model_manager/configs/qwen_vl_encoder.py:96

        # Reject anything that looks like a full pipeline (those are matched as Main models).
        if (mod.path / "model_index.json").exists() or (mod.path / "transformer").exists():
            raise NotAMatchError(
                "directory looks like a full diffusers pipeline (has model_index.json or transformer folder), "
                "not a standalone Qwen VL encoder"
            )

        text_encoder_dir = mod.path / "text_encoder"
        tokenizer_dir = mod.path / "tokenizer"

        if not text_encoder_dir.is_dir():
            raise NotAMatchError("missing text_encoder/ subfolder")
        if not tokenizer_dir.is_dir():
            raise NotAMatchError("missing tokenizer/ subfolder")

        config_path = text_encoder_dir / "config.json"
        if not config_path.is_file():
            raise NotAMatchError(f"missing {config_path}")

        try:
            with open(config_path, "r", encoding="utf-8") as f:
                cfg = json.load(f)
        except (OSError, json.JSONDecodeError) as e:
            raise NotAMatchError(f"could not read text_encoder/config.json: {e}") from e

        class_name = cfg.get("_class_name")
        architectures = cfg.get("architectures") or []
        candidates = {class_name, *architectures} - {None}

        if not candidates & _RECOGNIZED_TEXT_ENCODER_CLASSES:
            raise NotAMatchError(
                f"text_encoder class is {sorted(candidates) or 'unknown'}, "
                f"expected one of {sorted(_RECOGNIZED_TEXT_ENCODER_CLASSES)}"
            )

        return cls(**override_fields)

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Copy `config.json` from the corresponding Qwen2.5-VL/Qwen2-VL HF repo into `text_encoder/`
  2. Re-download the `text_encoder` folder completely (all json + safetensors files)
  3. Check for typos in the path; the file must be exactly `text_encoder/config.json`

Example fix

// before
huggingface-cli download Qwen/Qwen2.5-VL-7B --include "*.safetensors"
// after
huggingface-cli download Qwen/Qwen2.5-VL-7B --include "text_encoder/*"
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

def has_text_encoder_config(path: Path) -> bool:
    return (path / "text_encoder" / "config.json").is_file()

Type guard

def has_config_json(model_dir: Path) -> bool:
    cfg = model_dir / "text_encoder" / "config.json"
    return cfg.is_file() and cfg.stat().st_size > 0

Try / catch

try:
    cfg = QwenVLTextEncoderConfig.from_model_on_disk(mod, override_fields)
except NotAMatchError as e:
    if "missing" in str(e) and "config.json" in str(e):
        raise RuntimeError(f"Incomplete download: {mod.path} lacks text_encoder/config.json") from e
    raise

Prevention

When it happens

Trigger: Probing a model dir where `text_encoder/` exists as a directory but contains no `config.json` — e.g. only `.safetensors` weights were downloaded, the config.json was deleted, or the folder name is misspelled (`text_encode/`).

Common situations: Selective HF downloads that fetch only weight shards, `git lfs` partial checkouts where json files were not pulled, manual cleanup that removed 'small' json files, or configs flattened out of the subfolder.

Related errors


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