sgl-project/sglang · error · ValueError
chunk_index must be strictly increasing, got {normalized}.
Error message
chunk_index must be strictly increasing, got {normalized}. What it means
After normalization, chunk boundaries must be strictly increasing (and end at T). Any non-increasing adjacent pair — duplicate indices or a decrease — fails this invariant before slicing.
Source
Thrown at python/sglang/multimodal_gen/runtime/models/dits/sana_wm_components.py:417
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]],
) -> Optional[list[int]]:
T, _, _ = HW
if chunk_index is None and (chunk_size is None or int(chunk_size) >= T):
return None
boundaries = _sana_wm_normalize_chunk_index(
chunk_index,
T,
chunk_size=chunk_size,
chunk_split_strategy=chunk_split_strategy,View on GitHub (pinned to 0132848349)
Solutions
- Sort and deduplicate chunk_index before passing: sorted(set(chunk_index))
- Ensure all indices are in (0, T) and the list strictly increases
- Prefer passing chunk_size and letting the helper compute indices
Example fix
# before
idx = _sana_wm_normalize_chunk_index(T, chunk_index=[0, 8, 8, 16])
# after
idx = _sana_wm_normalize_chunk_index(T, chunk_index=sorted({0, 8, 8, 16})) Defensive patterns
Strategy: validation
Validate before calling
idx = sorted({int(i) for i in chunk_index if 0 < i < T})
assert all(b > a for a, b in zip(idx, idx[1:])) Prevention
- Always sorted(set(...)) user-provided index lists; prefer chunk_size
When it happens
Trigger: Passing chunk_index with duplicates like [0, 8, 8, 16], an unsorted list, or an index >= T (post-filtering can leave e.g. [0,0]); also indices not starting at 0 can interact badly with normalization.
Common situations: User-supplied chunk_index from config computed with float arithmetic then int()-cast (duplicates); indices generated for a larger T reused on a smaller clip (filtered to [0]); off-by-one in boundary generation.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- chunk_size must be > 0, got {chunk_size}.
- T must be > 0, got {T}.
- Unknown chunk_split_strategy '{strategy}'. Supported: unifor
- Either chunk_index or chunk_size must be provided.
- Unsupported content type ${header.content_type}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/dbb197b229b50d2a.
Report an issue: GitHub.