sgl-project/sglang · error · ValueError
Either num_inference_steps, sigmas, or timesteps must be pro
Error message
Either num_inference_steps, sigmas, or timesteps must be provided
What it means
set_timesteps needs some notion of schedule size; with num_inference_steps, sigmas, and timesteps all None it cannot build the sigma schedule and raises.
Source
Thrown at python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_flow_match_euler_discrete.py:326
and timesteps is not None
and len(sigmas) != len(timesteps)
):
raise ValueError("`sigmas` and `timesteps` should have the same length")
if num_inference_steps is not None:
if (sigmas is not None and len(sigmas) != num_inference_steps) or (
timesteps is not None and len(timesteps) != num_inference_steps
):
raise ValueError(
"`sigmas` and `timesteps` should have the same length as num_inference_steps, if `num_inference_steps` is provided"
)
else:
if sigmas is not None:
num_inference_steps = len(sigmas)
elif timesteps is not None:
num_inference_steps = len(timesteps)
else:
raise ValueError(
"Either num_inference_steps, sigmas, or timesteps must be provided"
)
self.num_inference_steps = num_inference_steps
# 1. Prepare default sigmas
is_timesteps_provided = timesteps is not None
timesteps_array: np.ndarray | None = None
if is_timesteps_provided:
assert timesteps is not None
timesteps_array = np.array(timesteps).astype(np.float32)
sigmas_array: np.ndarray
if sigmas is None:
if timesteps_array is None:
timesteps_array = np.linspace(
self._sigma_to_t(self.sigma_max),View on GitHub (pinned to 0132848349)
Solutions
- Pass num_inference_steps explicitly: scheduler.set_timesteps(50)
- Or pass a sigmas/timesteps list from which the count is inferred
- Audit refactor leftovers where the steps variable became None
Example fix
# before scheduler.set_timesteps() # after scheduler.set_timesteps(num_inference_steps=50)
Defensive patterns
Strategy: validation
Validate before calling
assert num_inference_steps is not None or sigmas is not None or timesteps is not None, "provide steps or a schedule"
Prevention
- Pass num_inference_steps explicitly
- Guard against None step counts after refactors
When it happens
Trigger: Calling scheduler.set_timesteps() with no arguments (relying on a previously stored default that does not exist in this implementation).
Common situations: Porting code from schedulers that default num_inference_steps=50; refactors that moved the step count into a variable that evaluates to None.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- v_cache must be provided
- q must be provided unless qv is provided with only_qv=True
- mask_block_cnt and mask_block_idx must be provided for block
- LoRA batch_info must provide max_len or seg_lens.
- kv-canary: launch_canary_plan_kernels_torch_reference requir
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/8aa396e9e3d2e1fb.
Report an issue: GitHub.