invoke-ai/InvokeAI · error · InvalidMatchError
PiD checkpoint has {channels} latent channels; no supported
Error message
PiD checkpoint has {channels} latent channels; no supported backbone uses this (supported: 4 for SDXL, 16 for FLUX.1/SD3/Qwen-Image, 128 for FLUX.2) What it means
Identification reads dimension 1 of the latent projection weight to learn the backbone's latent channel count. If it is not 4 (SDXL), 16 (FLUX.1/SD3/Qwen-Image), or 128 (FLUX.2), no supported PiD backbone config could ever claim the file, so an `InvalidMatchError` is raised (backbone-independent, preventing a bogus `Unknown_Config` registration).
Source
Thrown at invokeai/backend/model_manager/configs/pid_decoder.py:122
)
def _raise_if_no_backbone_can_accept(shapes: _Shapes) -> None:
"""Reject a PiD decoder that none of the five backbone configs could ever claim.
The counterpart to `_validate_base`, and the reason the two are separate. `_validate_base` decides
*which* backbone a checkpoint belongs to and says "not this one" with `NotAMatchError` — four of
the five classes are meant to say exactly that about every valid checkpoint. A rejection here is
backbone-independent, so all five would raise it for the same reason, leaving the file with no
match at all and letting the factory register it through the `Unknown_Config` fallback: a PiD
decoder on record as a model nothing can load. Hence `InvalidMatchError`.
Runs before the contract check because a decoder for an unsupported backbone would otherwise be
reported as a shape mismatch on one weight, which is true and useless.
"""
channels = shapes[_LATENT_PROJ_KEY][1] # type: ignore[index] # rank checked above
if channels not in _LATENT_CHANNELS_TO_BASES:
raise InvalidMatchError(
f"PiD checkpoint has {channels} latent channels; no supported backbone uses this "
"(supported: 4 for SDXL, 16 for FLUX.1/SD3/Qwen-Image, 128 for FLUX.2)"
)
def _and_more(items: list[Any]) -> str:
return f" (+ {len(items) - 5} more)" if len(items) > 5 else ""
def _raise_if_pid_net_contract_unmet(shapes: _Shapes, contract: Mapping[str, tuple[int, ...]]) -> None:
"""Hold the checkpoint to exactly the contract `load_pid_decoder` enforces.
Checking only the LQ projection accepted a file that carried every LQ weight and none of the 385
backbone weights; the loader then refused it. A subset check is not a milder version of the same
guarantee — loaders run under `skip_torch_weight_init()`, so a weight the checkpoint does not
supply is uninitialised memory rather than a default.
Missing *and* unexpected keys are fatal here because both are fatal there, which is what makesView on GitHub (pinned to 0b6a024f2f)
Solutions
- Verify the checkpoint was built for one of the supported backbones (SDXL, FLUX.1, FLUX.2, SD3, Qwen-Image) and re-download from nvidia/PiD
- Check the file isn't truncated or altered; compare the weight shape against the official release
- If it is a custom research decoder for a different latent space, it cannot be used — no code change will help
- Confirm you are not renaming/repacking weights that changed the tensor layout
Defensive patterns
Strategy: validation
Validate before calling
import torch
sd = torch.load(ckpt_path, map_location='cpu')
key = next(k for k in sd if 'lq_proj' in k and 'latent_proj' in k)
channels = sd[key].shape[1]
if channels not in (4, 16, 128):
raise SystemExit(f'{channels} latent channels: no supported PiD backbone uses this.') Type guard
def has_supported_latent_channels(sd: dict) -> bool:
key = next((k for k in sd if 'lq_proj' in k and 'latent_proj' in k), None)
return key is not None and sd[key].ndim == 4 and sd[key].shape[1] in (4, 16, 128) Try / catch
try:
install_model(path)
except InvalidMatchError as e:
if 'latent channels' in str(e):
logger.error('Checkpoint is for an unsupported backbone latent space: %s', e)
else:
raise Prevention
- Only download PiD decoders for supported backbones (SDXL, FLUX.1/2, SD3, Qwen-Image)
- Verify checksums after download to rule out corruption
- Be wary of custom fine-tunes with changed VAE latent spaces
When it happens
Trigger: Installing a PiD checkpoint whose `lq_proj.latent_proj.0.weight` has a channel count outside {4,16,128}; raised from `_raise_if_no_backbone_can_accept` during `from_model_on_disk`.
Common situations: Experimental/fine-tuned PiD decoders trained on a different VAE latent space; checkpoints repurposed for other backbones; corrupted or hand-modified weights.
Related errors
- PiD checkpoint has {len(mismatched)} weights whose shape Pid
- PiD decoder has lq_proj hidden dim {lq_hidden_dim}, but Invo
- Only CheckpointConfigBase models are currently supported her
- Expected QwenVLEncoder_Checkpoint_Config, got {type(config).
- Incompatible 'noise' and 'latents' shapes: ${latents.shape=}
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/d66dbca28d9dd603.
Report an issue: GitHub.