Comfy-Org/ComfyUI · error · ValueError
error invalid scheduler {scheduler_name}
Error message
error invalid scheduler {scheduler_name} What it means
comfy/samplers.py's calculate_sigmas looks up the requested scheduler name in SCHEDULER_HANDLERS; the names in that dict (karras, exponential, sgm_uniform, normal, linear_quadratic, beta, kl_optimal, etc.) are the only accepted values. An unknown name logs the error and raises ValueError before any sampling starts.
Source
Thrown at comfy/samplers.py:1383
SCHEDULER_HANDLERS = {
"simple": SchedulerHandler(simple_scheduler),
"sgm_uniform": SchedulerHandler(partial(normal_scheduler, sgm=True)),
"karras": SchedulerHandler(k_diffusion_sampling.get_sigmas_karras, use_ms=False),
"exponential": SchedulerHandler(k_diffusion_sampling.get_sigmas_exponential, use_ms=False),
"ddim_uniform": SchedulerHandler(ddim_scheduler),
"beta": SchedulerHandler(beta_scheduler),
"normal": SchedulerHandler(normal_scheduler),
"linear_quadratic": SchedulerHandler(linear_quadratic_schedule),
"kl_optimal": SchedulerHandler(kl_optimal_scheduler, use_ms=False),
}
SCHEDULER_NAMES = list(SCHEDULER_HANDLERS)
def calculate_sigmas(model_sampling: object, scheduler_name: str, steps: int) -> torch.Tensor:
handler = SCHEDULER_HANDLERS.get(scheduler_name)
if handler is None:
err = f"error invalid scheduler {scheduler_name}"
logging.error(err)
raise ValueError(err)
if handler.use_ms:
return handler.handler(model_sampling, steps)
return handler.handler(n=steps, sigma_min=float(model_sampling.sigma_min), sigma_max=float(model_sampling.sigma_max))
def sampler_object(name):
if name == "uni_pc":
sampler = KSAMPLER(uni_pc.sample_unipc)
elif name == "uni_pc_bh2":
sampler = KSAMPLER(uni_pc.sample_unipc_bh2)
elif name == "ddim":
sampler = ksampler("euler", inpaint_options={"random": True})
else:
sampler = ksampler(name)
return sampler
class KSampler:
SCHEDULERS = SCHEDULER_NAMES
SAMPLERS = SAMPLER_NAMESView on GitHub (pinned to 1c6d8d45b3)
Solutions
- Use a scheduler from comfy.samplers.SCHEDULER_NAMES (e.g. 'karras', 'exponential', 'sgm_uniform', 'normal', 'beta', 'linear_quadratic', 'kl_optimal').
- Validate/normalize user input against SCHEDULER_NAMES before calling calculate_sigmas (strip whitespace, lower-case).
- If the name came from a custom node, install that node or edit the workflow to a built-in scheduler.
- Update ComfyUI in case a newer scheduler you saw documented was added in a later version.
Example fix
# before
calculate_sigms = calculate_sigmas(model_sampling, 'sgm-uniform', 20) # typo
# after
from comfy.samplers import SCHEDULER_NAMES
name = 'sgm_uniform' if 'sgm-uniform' in name else name
assert name in SCHEDULER_NAMES, f'{name} not in {SCHEDULER_NAMES}'
sigmas = calculate_sigmas(model_sampling, name, 20) Defensive patterns
Strategy: validation
Validate before calling
from comfy.samplers import SCHEDULER_NAMES
scheduler = scheduler.strip().lower()
assert scheduler in SCHEDULER_NAMES, f'{scheduler!r} not in {SCHEDULER_NAMES}' Type guard
from comfy.samplers import SCHEDULER_NAMES
def is_valid_scheduler(name: str) -> bool:
return isinstance(name, str) and name.strip().lower() in SCHEDULER_NAMES Try / catch
try:
sigmas = comfy.samplers.calculate_sigmas(model_sampling, scheduler, steps)
except ValueError:
scheduler = 'karras'
sigmas = comfy.samplers.calculate_sigmas(model_sampling, scheduler, steps) Prevention
- Populate UI scheduler dropdowns from comfy.samplers.SCHEDULER_NAMES at runtime.
- Normalize user-provided scheduler strings (strip, lower-case) before use.
- After updating ComfyUI or custom nodes, refresh cached workflow combos.
When it happens
Trigger: Calling calculate_sigmas (or KSampler nodes) with a scheduler string not in SCHEDULER_NAMES: misspellings like 'karras ', 'sgm-uniform', 'normalv2', empty strings, or scheduler names from other UIs (A1111's 'sgm_uniform' variants, 'dpm_ceil') that ComfyUI never registered.
Common situations: Workflows imported from forks/custom nodes that added extra schedulers; stale frontend combo options after updating; API scripts hardcoding scheduler names; trailing whitespace or case differences ('Karras' vs 'karras').
Related errors
- schedule '{schedule}' unknown.
- Unsupported noise schedule {}. The schedule needs to be 'dis
- Order {order} too high for step {i}
- sigma_min and sigma_max must not be 0
- solver_type must be 'heun' or 'midpoint'
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/8c4f770d1878c610.
Report an issue: GitHub.