{"record":{"id":"05d839b7b6988519","repo":"sgl-project/sglang","slug":"name-must-be-an-int-or-a-sequence-of-ints","errorCode":null,"errorMessage":"{name} must be an int or a sequence of ints","messagePattern":"(.+?) must be an int or a sequence of ints","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":167,"sourceCode":"    per type.\n    \"\"\"\n    return minimax_h3_ref2va_video_presentation(\n        tokenizer,\n        prompt=prompt,\n        condition_labels=condition_labels,\n        image_token_count=image_token_count,\n        video_block_token_counts=None,\n        video_block_timestamps=None,\n    )\n\n\ndef _as_int_list(value: int | Sequence[int] | None, *, name: str) -> list[int]:\n    if value is None:\n        return []\n    if isinstance(value, int):\n        return [int(value)]\n    if not isinstance(value, Sequence) or isinstance(value, (str, bytes)):\n        raise ValueError(f\"{name} must be an int or a sequence of ints\")\n    return [int(item) for item in value]\n\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:","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/presentation.py#L149-L185","documentation":"_as_int_list normalizes image_token_count which may be a single int or a sequence of ints; anything else (float, str, dict, None handled separately) is rejected.","triggerScenarios":"Passing image_token_count=196.0, \"196\", or a numpy 2-D array to minimax_h3_ref2va_video_presentation; strings/bytes are explicitly rejected even though they are Sequences.","commonSituations":"JSON configs delivering numbers as strings; numpy float scalars from budget calculators; passing a dict of per-image counts.","solutions":["Coerce to int or list[int] before calling (e.g. int(x) or x.tolist())","Ensure config values are parsed as integers, not strings","For multiple images pass a list of ints"],"exampleFix":"// before\nimage_token_count=\"196\"\n// after\nimage_token_count=196","handlingStrategy":"type-guard","validationCode":"image_token_count = [int(v) for v in (image_token_count if isinstance(image_token_count, (list, tuple)) else [image_token_count])]","typeGuard":"def is_int_or_int_seq(v) -> bool:\n    if isinstance(v, bool):\n        return False\n    if isinstance(v, int):\n        return True\n    return isinstance(v, (list, tuple)) and not isinstance(v, (str, bytes)) and all(isinstance(i, int) for i in v)","tryCatchPattern":null,"preventionTips":["Parse config numbers as ints, never strings","Convert numpy scalars via int()/tolist() before passing"],"tags":["minimax-h3","type-validation","ref2va"],"backgroundTag":"type-validation-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}