mudler/LocalAI · error · RuntimeError

Failed to load pipeline '{pipeline_class.__name__}' from '{m

Error message

Failed to load pipeline '{pipeline_class.__name__}' from '{model_id}': {e}\nAvailable pipelines: {', '.join(available[:20])}...

What it means

Raised by load_diffusers_pipeline when pipeline_class.from_single_file() or from_pretrained() throws during the actual weight load. It wraps the original exception (chained with `from e`), names the class and model_id, and appends up to 20 available pipeline names as a corrective hint.

Source

Thrown at backend/python/diffusers/diffusers_dynamic_loader.py:499

    # Load the pipeline
    try:
        if from_single_file:
            # Check if the class has from_single_file method
            if hasattr(pipeline_class, 'from_single_file'):
                return pipeline_class.from_single_file(model_id, **kwargs)
            else:
                raise ValueError(
                    f"Pipeline class {pipeline_class.__name__} does not support from_single_file(). "
                    f"Use from_pretrained() instead."
                )
        else:
            return pipeline_class.from_pretrained(model_id, **kwargs)

    except Exception as e:
        # Provide helpful error message
        available = get_available_pipelines()
        raise RuntimeError(
            f"Failed to load pipeline '{pipeline_class.__name__}' from '{model_id}': {e}\n"
            f"Available pipelines: {', '.join(available[:20])}..."
        ) from e


def get_pipeline_info(class_name: str) -> Dict[str, Any]:
    """
    Get information about a specific pipeline class.

    Args:
        class_name: The pipeline class name

    Returns:
        Dictionary with pipeline information including:
        - name: Class name
        - aliases: List of task aliases
        - supports_single_file: Whether from_single_file() is available
        - docstring: Class docstring (if available)

View on GitHub (pinned to 44413a9d06)

Solutions

  1. Read the chained exception — the root cause (HTTP 401, FileNotFoundError, OOM) determines the fix; the pipeline list is secondary.
  2. For gated repos, provide a valid HuggingFace token in the environment/config.
  3. Verify the snapshot contents match the pipeline's expected file layout; re-download if incomplete.
  4. For OOM, pass torch_dtype=float16 / enable cpu offload via load_kwargs, or free other GPU processes first.
Defensive patterns

Strategy: try-catch

Validate before calling

import os
if os.path.isdir(model_id):
    missing = [f for f in ('model_index.json',) if not os.path.isfile(os.path.join(model_id, f))]
    assert not missing, f"incomplete diffusers snapshot: missing {missing}"
elif os.path.isfile(model_id):
    assert model_id.endswith(('.ckpt', '.safetensors')), 'not a single-file checkpoint'

Try / catch

try:
    pipe = load_diffusers_pipeline(class_name=c, model_id=m, **kw)
except RuntimeError as e:
    cause = e.__cause__  # original from_pretrained exception carries the real reason
    if isinstance(cause, (OSError, ConnectionError)):
        return error_reply("model download/conn issue; check network or HF token")
    if isinstance(cause, MemoryError) or 'out of memory' in str(cause).lower():
        return error_reply("OOM loading pipeline; try fp16 or a smaller model")
    return error_reply(str(e))

Prevention

When it happens

Trigger: Weight loading fails: missing/corrupt files in the model directory, auth-gated HuggingFace repo without a token, network failure fetching from the hub, dtype/variant mismatch (e.g. requesting fp16 variant that was not downloaded), or out-of-memory while initializing modules.

Common situations: Model directory incomplete (partial download), HF_TOKEN missing for gated models like SDXL/Flux, no network in an air-gapped deployment with local_only semantics, or insufficient VRAM/RAM during pipeline init.

Related errors


AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15). Data as JSON: /api/errors/10badaf00b45b206. Report an issue: GitHub.