{"record":{"id":"5e42a71216061808","repo":"sgl-project/sglang","slug":"name-must-not-mix-nested-and-flat-entries","errorCode":null,"errorMessage":"{name} must not mix nested and flat entries","messagePattern":"(.+?) must not mix nested and flat entries","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/presentation.py","lineNumber":187,"sourceCode":"\n\ndef _as_nested_int_list(\n    value: Sequence[int] | Sequence[Sequence[int]] | None,\n    *,\n    name: str,\n) -> list[list[int]]:\n    if value is None:\n        return []\n    if not isinstance(value, Sequence) or isinstance(value, (str, bytes)):\n        raise ValueError(f\"{name} must be a sequence\")\n    if len(value) == 0:\n        return []\n    first = value[0]\n    if isinstance(first, Sequence) and not isinstance(first, (str, bytes)):\n        out: list[list[int]] = []\n        for group in value:\n            if not isinstance(group, Sequence) or isinstance(group, (str, bytes)):\n                raise ValueError(f\"{name} must not mix nested and flat entries\")\n            out.append([int(item) for item in group])\n        return out\n    return [[int(item) for item in value]]\n\n\ndef _as_nested_float_list(\n    value: Sequence[float] | Sequence[Sequence[float]] | None,\n    *,\n    name: str,\n) -> list[list[float]]:\n    if value is None:\n        return []\n    if not isinstance(value, Sequence) or isinstance(value, (str, bytes)):\n        raise ValueError(f\"{name} must be a sequence\")\n    if len(value) == 0:\n        return []\n    first = value[0]\n    if isinstance(first, Sequence) and not isinstance(first, (str, bytes)):","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/presentation.py#L169-L205","documentation":"When the first element of video_block_token_counts is a sequence (nested form), every subsequent element must also be a sequence; mixing ints and lists is ambiguous and rejected.","triggerScenarios":"Passing video_block_token_counts=[[196,196], 128] — first entry nested, second flat.","commonSituations":"Concatenating per-video lists with stray scalars; heterogeneous data built from mixed sources; appending a default scalar to a list of lists.","solutions":["Normalize all entries to the same shape — nested lists for multiple videos ([[196],[128]]) or a flat list for a single video ([196,128])","Fix the data assembly to always append lists"],"exampleFix":"// before\nvideo_block_token_counts=[[196,196], 128]\n// after\nvideo_block_token_counts=[[196,196], [128]]","handlingStrategy":"validation","validationCode":"assert all(isinstance(g, (list, tuple)) for g in video_block_token_counts), \"uniform nesting required\"","typeGuard":"def uniform_nested(v: list) -> bool:\n    return all(isinstance(g, (list, tuple)) for g in v) or all(not isinstance(g, (list, tuple)) for g in v)","tryCatchPattern":null,"preventionTips":["Build per-video groups with one append path","Never mix scalars into nested lists"],"tags":["minimax-h3","shape-validation","video-presentation"],"backgroundTag":"shape-mismatch-validation","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}