mudler/LocalAI · error · ValueError
Invalid scheduler '{'k_' if is_karras else ''}{name}'
Error message
Invalid scheduler '{'k_' if is_karras else ''}{name}' What it means
Raised by the diffusers backend's scheduler factory when the requested scheduler name does not match any branch of the if/elif chain mapping DiffusionScheduler enum values to diffusers scheduler classes. The message echoes the name with a 'k_' prefix when K-Diffusion Karras scheduling was requested.
Source
Thrown at backend/python/diffusers/backend.py:211
# Equivalent to DPM2 in K-Diffusion
sched_class = KDPM2DiscreteScheduler
elif name == DiffusionScheduler.dpm_2_a:
# Equivalent to `DPM2 a`` in K-Diffusion
sched_class = KDPM2AncestralDiscreteScheduler
elif name == DiffusionScheduler.dpmpp_2m:
# Equivalent to `DPM++ 2M` in K-Diffusion
sched_class = DPMSolverMultistepScheduler
config["algorithm_type"] = "dpmsolver++"
config["solver_order"] = 2
elif name == DiffusionScheduler.dpmpp_sde:
# Equivalent to `DPM++ SDE` in K-Diffusion
sched_class = DPMSolverSinglestepScheduler
elif name == DiffusionScheduler.dpmpp_2m_sde:
# Equivalent to `DPM++ 2M SDE` in K-Diffusion
sched_class = DPMSolverMultistepScheduler
config["algorithm_type"] = "sde-dpmsolver++"
else:
raise ValueError(f"Invalid scheduler '{'k_' if is_karras else ''}{name}'")
return sched_class.from_config(config)
# Implement the BackendServicer class with the service methods
class BackendServicer(backend_pb2_grpc.BackendServicer):
def _load_pipeline(self, request, model_ref, from_single_file, local_only, torchType, variant, device_map=None):
"""
Load a diffusers pipeline dynamically using the dynamic loader.
This method uses load_diffusers_pipeline() for most pipelines, falling back
to explicit handling only for pipelines requiring custom initialization
(e.g., quantization, special VAE handling).
Args:
request: The gRPC request containing pipeline configuration
model_ref: Repository ID or local model file/directoryView on GitHub (pinned to 44413a9d06)
Solutions
- Use one of the supported scheduler names visible in the if/elif chain (e.g. dpmpp_2m, dpmpp_sde, dpmpp_2m_sde and the other branches above line 211).
- Update the backend image/repo so newly mapped schedulers are available.
- Check the exact enum value being sent — log request.Scheduler before the mapping; compare against the DiffusionScheduler enum definition.
- If a Karras variant was intended, verify the correct base name is passed and the is_karras flag is set rather than baking 'k_' into the name.
Example fix
# before request.Scheduler = "dpm++_2m_karras" # typo / raw KD name # after request.Scheduler = "dpmpp_2m" # matches DiffusionScheduler.dpmpp_2m branch
Defensive patterns
Strategy: validation
Validate before calling
valid_schedulers = {s.value for s in DiffusionScheduler}
assert request.Scheduler in valid_schedulers, f"unsupported scheduler {request.Scheduler!r}" Type guard
def is_supported_scheduler(name: str) -> bool:
return name in {s.value for s in DiffusionScheduler} Try / catch
try:
scheduler = build_scheduler(name, is_karras)
except ValueError as e:
return error_reply(f"{e}; supported: {sorted(s.value for s in DiffusionScheduler)}") Prevention
- Expose the DiffusionScheduler enum values in the API/UI so users pick from valid names.
- Keep backend and frontend versions aligned when new schedulers are added.
- Reject unknown scheduler names at request validation, not deep in the factory.
When it happens
Trigger: Requesting a scheduler value that the backend's mapping table does not cover — e.g. a newly added or experimental DiffusionScheduler member, or a raw string scheduler name passed through from the request that is not in the enum branches.
Common situations: Version mismatch: the request (or a newer LocalAI frontend) uses a scheduler name this backend build predates; a typo in the scheduler field of the request; or a K-Diffusion scheduler name (e.g. 'k_dpmpp_2m') passed where the diffusers backend expects the non-Karras enum spelling.
Related errors
- Unknown pipeline class '{class_name}'. Available pipelines:
- Unknown task '{task}'. Available tasks: {', '.join(sorted(al
- Failed to load pipeline '{effective_pipeline_type}': {e}\nAv
- Unknown pipeline: {class_name}
- Invalid scheduler, using default: %s\n
AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15).
Data as JSON: /api/errors/4b2723378757f191.
Report an issue: GitHub.