{"record":{"id":"8c4f770d1878c610","repo":"Comfy-Org/ComfyUI","slug":"error-invalid-scheduler-scheduler-name","errorCode":null,"errorMessage":"error invalid scheduler {scheduler_name}","messagePattern":"error invalid scheduler (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/samplers.py","lineNumber":1383,"sourceCode":"SCHEDULER_HANDLERS = {\n    \"simple\": SchedulerHandler(simple_scheduler),\n    \"sgm_uniform\": SchedulerHandler(partial(normal_scheduler, sgm=True)),\n    \"karras\": SchedulerHandler(k_diffusion_sampling.get_sigmas_karras, use_ms=False),\n    \"exponential\": SchedulerHandler(k_diffusion_sampling.get_sigmas_exponential, use_ms=False),\n    \"ddim_uniform\": SchedulerHandler(ddim_scheduler),\n    \"beta\": SchedulerHandler(beta_scheduler),\n    \"normal\": SchedulerHandler(normal_scheduler),\n    \"linear_quadratic\": SchedulerHandler(linear_quadratic_schedule),\n    \"kl_optimal\": SchedulerHandler(kl_optimal_scheduler, use_ms=False),\n}\nSCHEDULER_NAMES = list(SCHEDULER_HANDLERS)\n\ndef calculate_sigmas(model_sampling: object, scheduler_name: str, steps: int) -> torch.Tensor:\n    handler = SCHEDULER_HANDLERS.get(scheduler_name)\n    if handler is None:\n        err = f\"error invalid scheduler {scheduler_name}\"\n        logging.error(err)\n        raise ValueError(err)\n    if handler.use_ms:\n        return handler.handler(model_sampling, steps)\n    return handler.handler(n=steps, sigma_min=float(model_sampling.sigma_min), sigma_max=float(model_sampling.sigma_max))\n\ndef sampler_object(name):\n    if name == \"uni_pc\":\n        sampler = KSAMPLER(uni_pc.sample_unipc)\n    elif name == \"uni_pc_bh2\":\n        sampler = KSAMPLER(uni_pc.sample_unipc_bh2)\n    elif name == \"ddim\":\n        sampler = ksampler(\"euler\", inpaint_options={\"random\": True})\n    else:\n        sampler = ksampler(name)\n    return sampler\n\nclass KSampler:\n    SCHEDULERS = SCHEDULER_NAMES\n    SAMPLERS = SAMPLER_NAMES","sourceCodeStart":1365,"sourceCodeEnd":1401,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/samplers.py#L1365-L1401","documentation":"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.","triggerScenarios":"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.","commonSituations":"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').","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."],"exampleFix":"# before\ncalculate_sigms = calculate_sigmas(model_sampling, 'sgm-uniform', 20)  # typo\n\n# after\nfrom comfy.samplers import SCHEDULER_NAMES\nname = 'sgm_uniform' if 'sgm-uniform' in name else name\nassert name in SCHEDULER_NAMES, f'{name} not in {SCHEDULER_NAMES}'\nsigmas = calculate_sigmas(model_sampling, name, 20)","handlingStrategy":"validation","validationCode":"from comfy.samplers import SCHEDULER_NAMES\nscheduler = scheduler.strip().lower()\nassert scheduler in SCHEDULER_NAMES, f'{scheduler!r} not in {SCHEDULER_NAMES}'","typeGuard":"from comfy.samplers import SCHEDULER_NAMES\n\ndef is_valid_scheduler(name: str) -> bool:\n    return isinstance(name, str) and name.strip().lower() in SCHEDULER_NAMES","tryCatchPattern":"try:\n    sigmas = comfy.samplers.calculate_sigmas(model_sampling, scheduler, steps)\nexcept ValueError:\n    scheduler = 'karras'\n    sigmas = comfy.samplers.calculate_sigmas(model_sampling, scheduler, steps)","preventionTips":["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."],"tags":["sampling","scheduler","validation","config"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}