sgl-project/sglang · error · ValueError

Unknown chunk_split_strategy '{strategy}'. Supported: unifor

Error message

Unknown chunk_split_strategy '{strategy}'. Supported: uniform, first_frame, first_plus_one.

What it means

The chunk-split strategy must be one of uniform, first_frame, or first_plus_one. Any other string (after lowercasing) raises this ValueError listing valid options.

Source

Thrown at python/sglang/multimodal_gen/runtime/models/dits/sana_wm_components.py:386

        return indices

    if strategy in ("first_frame", "first_frame_alone", "first_frame_only"):
        if T <= 1:
            return [0]
        indices = [0] + list(range(1, T, chunk_size))
        if len(indices) > 2 and (T - indices[-1]) < chunk_size:
            indices.pop()
        return indices

    if strategy in ("first_plus_one", "first_chunk_plus_one"):
        if T <= chunk_size + 1:
            return [0]
        indices = [0] + list(range(chunk_size + 1, T, chunk_size))
        if len(indices) > 1 and (T - indices[-1]) < chunk_size:
            indices.pop()
        return indices

    raise ValueError(
        f"Unknown chunk_split_strategy '{strategy}'. Supported: "
        "uniform, first_frame, first_plus_one."
    )


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]

View on GitHub (pinned to 0132848349)

Solutions

  1. Use exactly one of: uniform, first_frame, first_plus_one (case-insensitive)
  2. Check the diffusers/upstream SANA-WM naming if porting; first_plus_one means indices [0] + range(chunk_size+1, T, chunk_size)
  3. Add an assert early in your pipeline config load

Example fix

# before
idx = _sana_wm_chunk_index_from_chunk_size(T, 8, strategy="first-frame")
# after
idx = _sana_wm_chunk_index_from_chunk_size(T, 8, strategy="first_frame")
Defensive patterns

Strategy: validation

Validate before calling

STRATS = {"uniform", "first_frame", "first_plus_one"}
assert strategy.lower() in STRATS, strategy

Type guard

def valid_strategy(s: str) -> bool: return str(s).lower() in {"uniform", "first_frame", "first_plus_one"}

Prevention

When it happens

Trigger: Passing chunk_split_strategy='first_frame_plus_one', 'first-frame', or a typo like 'unifrom' to the chunking helpers; also a config value of None that was later str()-mangled incorrectly (None actually maps to 'uniform' and is fine).

Common situations: Config file strategy names drifting from upstream (the codebase renamed strategies); copying strategy strings from a different SANA implementation.

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


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/d311f3f16f31b321. Report an issue: GitHub.