{"record":{"id":"2453a2bceb14771d","repo":"sgl-project/sglang","slug":"sigmas-and-timesteps-should-have-the-same-leng","errorCode":null,"errorMessage":"`sigmas` and `timesteps` should have the same length","messagePattern":"`sigmas` and `timesteps` should have the same length","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_flow_match_euler_discrete.py","lineNumber":311,"sourceCode":"            mu (`float`, *optional*):\n                Determines the amount of shifting applied to sigmas when performing resolution-dependent timestep\n                shifting.\n            timesteps (`List[float]`, *optional*):\n                Custom values for timesteps to be used for each diffusion step. If `None`, the timesteps are computed\n                automatically.\n        \"\"\"\n\n        if self.config.use_dynamic_shifting and mu is None:\n            raise ValueError(\n                \"`mu` must be passed when `use_dynamic_shifting` is set to be `True`\"\n            )\n\n        if (\n            sigmas is not None\n            and timesteps is not None\n            and len(sigmas) != len(timesteps)\n        ):\n            raise ValueError(\"`sigmas` and `timesteps` should have the same length\")\n\n        if num_inference_steps is not None:\n            if (sigmas is not None and len(sigmas) != num_inference_steps) or (\n                timesteps is not None and len(timesteps) != num_inference_steps\n            ):\n                raise ValueError(\n                    \"`sigmas` and `timesteps` should have the same length as num_inference_steps, if `num_inference_steps` is provided\"\n                )\n        else:\n            if sigmas is not None:\n                num_inference_steps = len(sigmas)\n            elif timesteps is not None:\n                num_inference_steps = len(timesteps)\n            else:\n                raise ValueError(\n                    \"Either num_inference_steps, sigmas, or timesteps must be provided\"\n                )\n","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_flow_match_euler_discrete.py#L293-L329","documentation":"When both sigmas and timesteps are provided to set_timesteps they must describe the same schedule step-for-step; mismatched lengths raise this validation error before anything is assigned.","triggerScenarios":"Passing 50 sigmas (including terminal) with 49 timesteps, or reusing sigmas from one step count with timesteps from another.","commonSituations":"Custom schedules where users forget the terminal sigma (length N+1) versus N timesteps; mixing schedules generated for different num_inference_steps.","solutions":["Make len(sigmas) == len(timesteps); trim or pad the terminal sigma accordingly","Generate both from the same num_inference_steps and pass only one of them","Validate lengths in your schedule-generation code before calling"],"exampleFix":"# before\nscheduler.set_timesteps(50, sigmas=sigmas, timesteps=ts)  # len 51 vs 50\n# after\nscheduler.set_timesteps(50, sigmas=sigmas[:-1], timesteps=ts)","handlingStrategy":"validation","validationCode":"assert sigmas is None or timesteps is None or len(sigmas) == len(timesteps)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Decide one terminal-sigma convention and stick to it","Generate sigmas and timesteps from the same source"],"tags":["scheduler","length-mismatch","validation"],"backgroundTag":"schedule-length-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}