sgl-project/sglang · error · ValueError
Either chunk_index or chunk_size must be provided.
Error message
Either chunk_index or chunk_size must be provided.
What it means
_sana_wm_normalize_chunk_index needs either an explicit chunk_index list or a chunk_size to derive boundaries. Supplying neither makes chunk boundary computation impossible.
Source
Thrown at python/sglang/multimodal_gen/runtime/models/dits/sana_wm_components.py:407
)
def _sana_wm_normalize_chunk_index(
chunk_index: Optional[List[int]],
T: int,
chunk_size: Optional[int] = None,
chunk_split_strategy: str = "uniform",
) -> list[int]:
if chunk_index is not None:
normalized = [int(idx) for idx in chunk_index]
if not normalized or normalized[0] != 0:
normalized = [0] + [idx for idx in normalized if idx > 0]
normalized = [idx for idx in normalized if idx < T]
if not normalized:
normalized = [0]
else:
if chunk_size is None:
raise ValueError("Either chunk_index or chunk_size must be provided.")
normalized = _sana_wm_chunk_index_from_chunk_size(
T,
int(chunk_size),
strategy=chunk_split_strategy,
)
if normalized[-1] != T:
normalized.append(T)
if any(end <= start for start, end in zip(normalized[:-1], normalized[1:])):
raise ValueError(f"chunk_index must be strictly increasing, got {normalized}.")
return normalized
def _sana_wm_chunk_boundaries_for_attention(
HW: Tuple[int, int, int],
chunk_size: Optional[int],
chunk_split_strategy: str,
chunk_index: Optional[List[int]],View on GitHub (pinned to 0132848349)
Solutions
- Set either chunk_index (list of boundary frame indices) or chunk_size (positive int) in the block config / call
- If you intended unchunked processing, pass chunk_size equal to the full T
- Default chunk_size in your config loader, e.g. chunk_size if chunk_size is not None else 32
Example fix
# before bounds = _sana_wm_normalize_chunk_index(T, chunk_index=None, chunk_size=None) # after bounds = _sana_wm_normalize_chunk_index(T, chunk_index=None, chunk_size=32)
Defensive patterns
Strategy: validation
Validate before calling
assert (chunk_index is None) != (chunk_size is None), 'provide exactly one of chunk_index/chunk_size'
Prevention
- Default chunk_size in config loader: chunk_size or 32
When it happens
Trigger: Calling the attention/GDN chunk-scan path (via _sana_wm_chunk_boundaries_for_attention or _gdn_chunk_scan_forward) with both chunk_index=None and chunk_size=None.
Common situations: New model config omitting chunk_gdn_chunk_size; a wrapper that conditionally forwards only one of the two kwargs and the condition picked neither; None defaults propagating from an unset config object.
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
- SANA-WM forward requires encoder_hidden_states.
- SANA-WM forward requires timestep.
- SANA-WM forward_long requires encoder_hidden_states.
- SANA-WM forward_long requires timestep.
- chunk_size must be > 0, got {chunk_size}.
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/e09984c02c0b32b4.
Report an issue: GitHub.