invoke-ai/InvokeAI · warning · NotAMatchError
hidden_size {hidden_size} does not match a known Qwen3 varia
Error message
hidden_size {hidden_size} does not match a known Qwen3 variant What it means
After successfully reading config.json, _get_variant_from_config compares the `hidden_size` field against the known Qwen3 sizes (8B=4096, 4B=2560, 0.6B=1024). If no size matches, the model is not a recognized Qwen3 variant and a NotAMatchError is raised so another config class can claim the model. This prevents silently treating an unknown model as Qwen3.
Source
Thrown at invokeai/backend/model_manager/configs/qwen3_encoder.py:383
"""Get variant from config.json based on hidden_size, or raise NotAMatch if unknown."""
QWEN3_06B_HIDDEN_SIZE = 1024
QWEN3_4B_HIDDEN_SIZE = 2560
QWEN3_8B_HIDDEN_SIZE = 4096
try:
with open(config_path, "r", encoding="utf-8") as f:
config = json.load(f)
except (json.JSONDecodeError, OSError) as e:
raise NotAMatchError(f"unable to read Qwen3 config.json: {e}") from e
hidden_size = config.get("hidden_size")
if hidden_size == QWEN3_8B_HIDDEN_SIZE:
return Qwen3VariantType.Qwen3_8B
elif hidden_size == QWEN3_4B_HIDDEN_SIZE:
return Qwen3VariantType.Qwen3_4B
elif hidden_size == QWEN3_06B_HIDDEN_SIZE:
return Qwen3VariantType.Qwen3_06B
raise NotAMatchError(f"hidden_size {hidden_size} does not match a known Qwen3 variant")
class Qwen3Encoder_GGUF_Config(Checkpoint_Config_Base, Config_Base):
"""Configuration for GGUF-quantized Qwen3 Encoder models."""
base: Literal[BaseModelType.Any] = Field(default=BaseModelType.Any)
type: Literal[ModelType.Qwen3Encoder] = Field(default=ModelType.Qwen3Encoder)
format: Literal[ModelFormat.GGUFQuantized] = Field(default=ModelFormat.GGUFQuantized)
cpu_only: bool | None = Field(default=None, description="Whether this model should run on CPU only")
variant: Qwen3VariantType = Field(description="Qwen3 model size variant (4B or 8B)")
@classmethod
def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:
raise_if_not_file(mod)
raise_for_override_fields(cls, override_fields)
cls._validate_looks_like_qwen3_model(mod)View on GitHub (pinned to 0b6a024f2f)
Solutions
- Check `hidden_size` in the model's config.json; if it is 4096/2560/1024 fix any typo — otherwise the model is a size InvokeAI does not classify as Qwen3 8B/4B/0.6B.
- Upgrade InvokeAI to the latest version, as new Qwen3 variants are added over time.
- If the model is genuinely not one of the supported variants, use a different model or a manually configured loader instead of auto-identification.
- If it's a non-Qwen3 model, ignore the error — NotAMatchError here is expected and other config classes will match.
Example fix
// before (config.json of an unsupported variant)
{"hidden_size": 2048}
// after (use a supported variant, e.g. Qwen3-4B)
{"hidden_size": 2560}
Defensive patterns
Strategy: validation
Validate before calling
import json
SUPPORTED = {4096: '8B', 2560: '4B', 1024: '0.6B'}
def is_supported_qwen3_variant(model_dir):
with open(f'{model_dir}/config.json', 'r', encoding='utf-8') as f:
hs = json.load(f).get('hidden_size')
return hs in SUPPORTED Type guard
def is_known_qwen3_hidden_size(hidden_size) -> bool:
return hidden_size in (4096, 2560, 1024) Try / catch
try:
variant = _get_variant_from_config(config_path)
except NotAMatchError as e:
print(f'Model is not a supported Qwen3 variant: {e}. '
'Check hidden_size in config.json or upgrade InvokeAI.') Prevention
- Check the model's hidden_size against the supported list before installing.
- Keep InvokeAI updated so newly released Qwen3 sizes are recognized.
- Don't edit hidden_size in config.json; it must match the actual weights.
When it happens
Trigger: from_model_on_disk probing a directory whose config.json parses fine but has a hidden_size not in {4096, 2560, 1024} — e.g. Qwen3-1.7B (2048), Qwen3-14B/32B, Qwen2 variants, or a hand-edited hidden_size value.
Common situations: Trying to install a Qwen3 model size InvokeAI doesn't yet recognize (1.7B, 14B, 32B); a renamed/misconfigured config.json with wrong hidden_size; non-Qwen3 causal-LM configs probed by this class.
Related errors
- state dict does not look like a Qwen3 model
- unable to read Qwen3 config.json: {e}
- state dict does not look like GGUF quantized
- Only Qwen3VLEncoder_Checkpoint_Config models are supported h
- Failed to remove image from board
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/feb278dc4e096e4b.
Report an issue: GitHub.