mudler/LocalAI · error · ValueError

Must provide at least one of: class_name, task, or…

Error message

Must provide at least one of: class_name, task, or model_id. Available pipelines: {', '.join(sorted(registry.keys())[:20])}... Available tasks: {', '.join(sorted(aliases.keys())[:20])}...

What it means

Raised by resolve_pipeline_class as its final guard: all three resolution inputs were falsy — no class_name, no task, and no model_id — so there is nothing to resolve and the HuggingFace-inference branch (which requires model_id) was skipped. The message lists both available pipeline classes and task aliases.

Solutions

  1. Supply at least one of the three arguments; model_id alone is usually sufficient (auto-detection via the model card).
  2. Fix the caller: log the arguments at the call site to find which layer dropped them.
  3. If wrapping this API, validate inputs before calling and raise a domain-specific error instead.

Example fix

# before
pipe = load_diffusers_pipeline()

# after
pipe = load_diffusers_pipeline(model_id=model_ref)
Defensive patterns

Strategy: validation

Validate before calling

assert class_name or task or model_id, (
    "load_diffusers_pipeline needs at least one of class_name/task/model_id")

Type guard

def has_resolution_input(class_name, task, model_id) -> bool:
    return bool(class_name or task or model_id)

Try / catch

try:
    pipe = load_diffusers_pipeline(class_name=c, task=t, model_id=m)
except ValueError as e:
    if "Must provide at least one" in str(e):
        raise ProgrammingError("loader called without any resolution input") from e
    raise

Prevention

When it happens

Trigger: Calling load_diffusers_pipeline() (or resolve_pipeline_class) with all of class_name, task, and model_id as None/empty — typically a caller bug that failed to populate any argument.

Common situations: A request pipeline where the user omitted both pipeline type and model, a default-argument refactor that dropped model_id propagation, or a config file where all optional fields were left blank.

Related errors


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

Appendix: source

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

        except ImportError:
            # huggingface_hub not available
            pass
        except (KeyError, AttributeError, ValueError, OSError):
            # Model info lookup failed - common cases:
            # - KeyError: Missing keys in model card
            # - AttributeError: Missing attributes on model info
            # - ValueError: Invalid model data
            # - OSError: Network or file access issues
            pass

        # Fallback: use DiffusionPipeline.from_pretrained which auto-detects
        # DiffusionPipeline is always added to registry in _discover_pipelines (line 132)
        # but use .get() with import fallback for extra safety
        from diffusers import DiffusionPipeline
        return registry.get('DiffusionPipeline', DiffusionPipeline)

    raise ValueError(
        "Must provide at least one of: class_name, task, or model_id. "
        f"Available pipelines: {', '.join(sorted(registry.keys())[:20])}... "
        f"Available tasks: {', '.join(sorted(aliases.keys())[:20])}..."
    )


def load_diffusers_pipeline(
    class_name: Optional[str] = None,
    task: Optional[str] = None,
    model_id: Optional[str] = None,
    from_single_file: bool = False,
    **kwargs
) -> Any:
    """
    Load a diffusers pipeline dynamically.

    This function resolves the appropriate pipeline class based on the provided
    parameters and instantiates it with the given kwargs.

View on GitHub (pinned to 44413a9d06)