{"record":{"id":"efd2d4215710a153","repo":"Comfy-Org/ComfyUI","slug":"unknown-context-schedule-context-schedule","errorCode":null,"errorMessage":"Unknown context_schedule '{context_schedule}'.","messagePattern":"Unknown context_schedule '(.+?)'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/context_windows.py","lineNumber":930,"sourceCode":"    return windows\n\n\ndef create_windows_default(num_frames: int, handler: IndexListContextHandler):\n    return [list(range(num_frames))]\n\n\nCONTEXT_MAPPING = {\n    ContextSchedules.UNIFORM_LOOPED: create_windows_uniform_looped,\n    ContextSchedules.UNIFORM_STANDARD: create_windows_uniform_standard,\n    ContextSchedules.STATIC_STANDARD: create_windows_static_standard,\n    ContextSchedules.BATCHED: create_windows_batched,\n}\n\n\ndef get_matching_context_schedule(context_schedule: str) -> ContextSchedule:\n    func = CONTEXT_MAPPING.get(context_schedule, None)\n    if func is None:\n        raise ValueError(f\"Unknown context_schedule '{context_schedule}'.\")\n    return ContextSchedule(context_schedule, func)\n\n\ndef get_context_weights(length: int, full_length: int, idxs: list[int], handler: IndexListContextHandler, sigma: torch.Tensor=None, context_overlap: int=None):\n    context_overlap = handler.context_overlap if context_overlap is None else context_overlap\n    return handler.fuse_method.func(length, sigma=sigma, handler=handler, full_length=full_length, idxs=idxs, context_overlap=context_overlap)\n\n\ndef create_weights_flat(length: int, **kwargs) -> list[float]:\n    # weight is the same for all\n    return [1.0] * length\n\ndef create_weights_pyramid(length: int, **kwargs) -> list[float]:\n    # weight is based on the distance away from the edge of the context window;\n    # based on weighted average concept in FreeNoise paper\n    if length % 2 == 0:\n        max_weight = length // 2\n        weight_sequence = list(range(1, max_weight + 1, 1)) + list(range(max_weight, 0, -1))","sourceCodeStart":912,"sourceCodeEnd":948,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/context_windows.py#L912-L948","documentation":"get_matching_context_schedule maps a schedule-name string to a window-creation function via CONTEXT_MAPPING, which only contains the ContextSchedules enum values (UNIFORM_LOOPED, UNIFORM_STANDARD, STATIC_STANDARD, BATCHED). Any other string raises ValueError with the offending name quoted — this is strict enum-style validation of user/node input.","triggerScenarios":"A node or workflow passes a schedule string not in the enum (typos like 'uniform_loop' or 'standard'); custom nodes hardcoding schedule names from an older/newer ComfyUI where the enum differs; dynamically-built prompts injecting arbitrary strings.","commonSituations":"Version drift after enum values were added/renamed; workflows saved with a custom node's schedule names; spaces or case differences ('Uniform Looped').","solutions":["Use one of the exact values: check ContextSchedules in comfy/context_windows.py and pass e.g. ContextSchedules.UNIFORM_STANDARD.","Expose schedule selection as a combo of the enum values in your node rather than free text.","Validate/normalize user input against list(CONTEXT_MAPPING) before calling."],"exampleFix":"# before\nget_matching_context_schedule(\"uniform_loop\")\n\n# after\nfrom comfy.context_windows import ContextSchedules, get_matching_context_schedule\nget_matching_context_schedule(ContextSchedules.UNIFORM_LOOPED)","handlingStrategy":"validation","validationCode":"from comfy.context_windows import CONTEXT_MAPPING\nif context_schedule not in CONTEXT_MAPPING:\n    raise SystemExit(f\"unknown schedule; valid: {list(CONTEXT_MAPPING)}\")\nsched = get_matching_context_schedule(context_schedule)","typeGuard":"from comfy.context_windows import CONTEXT_MAPPING\ndef is_valid_schedule(name: str) -> bool:\n    return name in CONTEXT_MAPPING","tryCatchPattern":"try:\n    sched = get_matching_context_schedule(name)\nexcept ValueError:\n    name = \"uniform_standard\"  # safe default\n    sched = get_matching_context_schedule(name)","preventionTips":["Use the ContextSchedules enum instead of string literals.","Offer schedule choices from list(CONTEXT_MAPPING) in node combos."],"tags":["context-windows","validation","enum"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}