invoke-ai/InvokeAI · error · ValueError

Multiple weight files found for this model: {ps}. Please spe

Error message

Multiple weight files found for this model: {ps}. Please specify the intended file using the 'path' argument

What it means

resolve_weight_file() scans a model's directory on disk for candidate weight files. When it finds two or more, it cannot guess which one is intended, so it raises ValueError listing all candidates and asking the caller to disambiguate via the 'path' argument of the model-import config.

Source

Thrown at invokeai/backend/model_manager/model_on_disk.py:170

        # Normalize PEFT named-adapter keys (e.g. `lora_A.default.weight` → `lora_A.weight`).
        # Pattern is LoRA-specific, so this is a no-op for non-LoRA state dicts.
        from invokeai.backend.patches.lora_conversions.peft_adapter_utils import normalize_peft_adapter_names

        state_dict = normalize_peft_adapter_names(state_dict)

        self._state_dict_cache[path] = state_dict
        return state_dict

    def resolve_weight_file(self, path: Optional[Path] = None) -> Path:
        if not path:
            weight_files = list(self.weight_files())
            match weight_files:
                case []:
                    raise ValueError("No weight files found for this model")
                case [p]:
                    return p
                case ps if len(ps) >= 2:
                    raise ValueError(
                        f"Multiple weight files found for this model: {ps}. "
                        f"Please specify the intended file using the 'path' argument"
                    )
        return path

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Set the 'path' field in the model's install/import config to the exact relative path of the intended weight file.
  2. Remove or move the unwanted duplicate weight files out of the model directory.
  3. If the duplicates are download artifacts, delete the model and re-download it cleanly.

Example fix

// before: import config with no path, folder has model.safetensors and model-fp16.safetensors
ModelInstaller().install(path_or_url, config)
// after
config = StableDiffusionDiffusersConfig(path='model.safetensors')
ModelInstaller().install(path_or_url, config)
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
WEIGHT_EXTS = {'.safetensors', '.ckpt', '.pt', '.pth', '.bin'}
weight_files = [p for p in Path(model_dir).rglob('*') if p.suffix.lower() in WEIGHT_EXTS]
if len(weight_files) > 1:
    raise ValueError(f'Choose one weight file: {weight_files}')

Type guard

def has_single_weight_file(d: Path) -> bool:
    exts = {'.safetensors', '.ckpt', '.pt', '.pth', '.bin'}
    files = [p for p in d.rglob('*') if p.is_file() and p.suffix.lower() in exts]
    return len(files) == 1

Prevention

When it happens

Trigger: Importing or loading a ModelOnDisk whose directory contains >= 2 weight files (e.g. model.safetensors plus a checkpoint subdir or duplicate .safetensors/.ckpt), which makes `weight_files` match the `case ps if len(ps) >= 2` branch. Called via load_state_dict() or metadata().

Common situations: Downloading a repo that ships both fp16 and fp32 safetensors variants; a repo with both .safetensors and .ckpt/.bin files; resuming a partially re-downloaded model that left duplicate weights; manually copying extra checkpoints into the model folder.

Related errors


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