invoke-ai/InvokeAI · error · RuntimeError
{source} is missing model parameters: {sorted(incompatible_k
Error message
{source} is missing model parameters: {sorted(incompatible_keys.missing_keys)[:10]} What it means
After loading Wan single-file checkpoint weights, load_state_dict reports missing keys — tensors in the state dict that the model expects but the checkpoint lacks. Benign extras were already filtered out, so reaching this means the checkpoint genuinely does not contain the required parameters for the configured Wan architecture.
Source
Thrown at invokeai/backend/model_manager/load/model_loaders/wan.py:295
Missing keys are the obvious error. Unexpected keys matter just as much here and
are far easier to miss: several Wan 2.2 derivatives are supersets of the plain
transformer — Fun-Camera adds ``control_adapter.*`` (6 keys), S2V adds
``audio_injector``/``cond_encoder``/``frame_packer`` (165 keys), Animate adds
``face_adapter``/``motion_encoder`` (127 keys). They match the probe, build a
correctly-shaped ``WanTransformer3DModel``, report zero missing keys, and then
generate with the entire branch they were built around silently absent.
``configs.main._find_unsupported_wan_variant_marker`` turns away the families we
know by name; this is the generic backstop, so a derivative nobody has enumerated
yet produces an error instead of quietly degraded output.
Benign extras — bundled VAE/text-encoder weights and merged-LoRA residue — have
already been removed by ``_drop_benign_extra_keys``, so anything reaching here is
genuinely unplaceable.
"""
if incompatible_keys.missing_keys:
raise RuntimeError(f"{source} is missing model parameters: {sorted(incompatible_keys.missing_keys)[:10]}")
unexpected = [key for key in incompatible_keys.unexpected_keys if isinstance(key, str)]
if unexpected:
# Report the distinct top-level module names rather than hundreds of keys.
modules = sorted({key.split(".")[0] for key in unexpected})
raise RuntimeError(
f"{source} has {len(unexpected)} weights that WanTransformer3DModel has nowhere to put "
f"(modules: {', '.join(modules[:8])}). This is a Wan variant with extra conditioning "
"branches — Animate, S2V, Fun-Camera and similar — which InvokeAI cannot run faithfully; "
"loading it anyway would silently ignore that conditioning."
)
def _tensor_shape(tensor: Any) -> tuple[int, ...]:
"""Logical shape of a tensor, unwrapping GGMLTensor's packed storage.
A GGMLTensor's ``.shape`` describes the packed quantized blob, not the weight,
so the logical dimensions live on ``.tensor_shape``.View on GitHub (pinned to 0b6a024f2f)
Solutions
- Re-download the checkpoint and verify its size/checksum against the source.
- Ensure the model config (variant, parameter count) matches the actual checkpoint (e.g., 1.3B vs 14B vs A14B).
- Check the message's key list to identify missing modules; obtain an unpruned/unmodified checkpoint if layers were stripped.
- Update InvokeAI in case key-conversion/prefix-strip rules for your checkpoint naming were added.
Example fix
// before: config says 14B, file is 1.3B checkpoint config = Main_Checkpoint_Wan_Config(path=wan_1_3b.safetensors, variant='14b') // after: matching variant config = Main_Checkpoint_Wan_Config(path=wan_1_3b.safetensors, variant='1.3b')
Defensive patterns
Strategy: validation
Validate before calling
from safetensors import safe_open
def validate_wan_checkpoint(path, required_prefix='model.diffusion_model.'):
with safe_open(path, framework='pt') as f:
keys = list(f.keys())
if not any(required_prefix in k or k.startswith('patch_embedding') for k in keys):
raise ValueError(f"{path} does not look like a Wan transformer checkpoint") Try / catch
try:
model = loader.load_model(config, SubModelType.Transformer)
except RuntimeError as e:
if 'is missing model parameters' in str(e):
handle_corrupt_or_mismatched_checkpoint(config, e) # re-download / fix variant
else:
raise Prevention
- Verify download size/checksum before registering checkpoints.
- Match model variant config (1.3B / 14B / A14B) to the actual checkpoint file.
- Avoid 'pruned' community checkpoints with stripped layers for single-file loading.
- Keep InvokeAI updated for the latest key-conversion rules.
When it happens
Trigger: _load_from_singlefile builds a WanTransformer3DModel from a checkpoint whose weights don't cover the expected modules (wrong variant/size checkpoint for the config); truncated or corrupted .safetensors/.pth file; mismatched key naming that prefix-stripping couldn't fix.
Common situations: Downloading a partial checkpoint (interrupted download); pairing a Wan 1.3B checkpoint with a 14B config or vice versa; community 'pruned' checkpoints with layers stripped; renamed keys the converter doesn't recognize.
Related errors
- {source} is missing {key} after prefix strip and key convers
- {source} has {len(unexpected)} weights that WanTransformer3D
- Expected Main_Checkpoint_Wan_Config, got {type(config).__nam
- Only the Transformer submodel is available from a single-fil
- PiD checkpoint has unexpected keys not present in PidNet: {u
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/769cb2acca9b937a.
Report an issue: GitHub.