{"record":{"id":"d311f3f16f31b321","repo":"sgl-project/sglang","slug":"unknown-chunk-split-strategy-strategy-support","errorCode":null,"errorMessage":"Unknown chunk_split_strategy '{strategy}'. Supported: uniform, first_frame, first_plus_one.","messagePattern":"Unknown chunk_split_strategy '(.+?)'\\. Supported: uniform, first_frame, first_plus_one\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/dits/sana_wm_components.py","lineNumber":386,"sourceCode":"        return indices\n\n    if strategy in (\"first_frame\", \"first_frame_alone\", \"first_frame_only\"):\n        if T <= 1:\n            return [0]\n        indices = [0] + list(range(1, T, chunk_size))\n        if len(indices) > 2 and (T - indices[-1]) < chunk_size:\n            indices.pop()\n        return indices\n\n    if strategy in (\"first_plus_one\", \"first_chunk_plus_one\"):\n        if T <= chunk_size + 1:\n            return [0]\n        indices = [0] + list(range(chunk_size + 1, T, chunk_size))\n        if len(indices) > 1 and (T - indices[-1]) < chunk_size:\n            indices.pop()\n        return indices\n\n    raise ValueError(\n        f\"Unknown chunk_split_strategy '{strategy}'. Supported: \"\n        \"uniform, first_frame, first_plus_one.\"\n    )\n\n\ndef _sana_wm_normalize_chunk_index(\n    chunk_index: Optional[List[int]],\n    T: int,\n    chunk_size: Optional[int] = None,\n    chunk_split_strategy: str = \"uniform\",\n) -> list[int]:\n    if chunk_index is not None:\n        normalized = [int(idx) for idx in chunk_index]\n        if not normalized or normalized[0] != 0:\n            normalized = [0] + [idx for idx in normalized if idx > 0]\n        normalized = [idx for idx in normalized if idx < T]\n        if not normalized:\n            normalized = [0]","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/dits/sana_wm_components.py#L368-L404","documentation":"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.","triggerScenarios":"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).","commonSituations":"Config file strategy names drifting from upstream (the codebase renamed strategies); copying strategy strings from a different SANA implementation.","solutions":["Use exactly one of: uniform, first_frame, first_plus_one (case-insensitive)","Check the diffusers/upstream SANA-WM naming if porting; first_plus_one means indices [0] + range(chunk_size+1, T, chunk_size)","Add an assert early in your pipeline config load"],"exampleFix":"# before\nidx = _sana_wm_chunk_index_from_chunk_size(T, 8, strategy=\"first-frame\")\n# after\nidx = _sana_wm_chunk_index_from_chunk_size(T, 8, strategy=\"first_frame\")","handlingStrategy":"validation","validationCode":"STRATS = {\"uniform\", \"first_frame\", \"first_plus_one\"}\nassert strategy.lower() in STRATS, strategy","typeGuard":"def valid_strategy(s: str) -> bool: return str(s).lower() in {\"uniform\", \"first_frame\", \"first_plus_one\"}","tryCatchPattern":null,"preventionTips":["Validate strategy strings against a module-level constant set at config load"],"tags":["sana-wm","chunking","invalid-enum","config"],"backgroundTag":"invalid-argument-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}