{"record":{"id":"d771d825e59cf0a9","repo":"sgl-project/sglang","slug":"tar-material-offset-data-and-size-must-be-non-nega","errorCode":null,"errorMessage":"tar material offset_data and size must be non-negative","messagePattern":"tar material offset_data and size must be non-negative","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/material_io.py","lineNumber":187,"sourceCode":"            ).decode(\"utf-8\")\n        )\n    except Exception as exc:\n        raise ValueError(\"tar material URI has an invalid encoded header\") from exc\n    if not isinstance(header, dict):\n        raise ValueError(\"tar material URI header must be a JSON object\")\n    if header.get(\"schema\") != \"sglang.tar_member_ref/v1\":\n        raise ValueError(\n            f\"unsupported tar material header schema: {header.get('schema')!r}\"\n        )\n    try:\n        offset = int(header[\"offset_data\"])\n        size = int(header[\"size\"])\n    except (KeyError, TypeError, ValueError) as exc:\n        raise ValueError(\n            \"tar material header requires integer offset_data and size\"\n        ) from exc\n    if offset < 0 or size < 0:\n        raise ValueError(\"tar material offset_data and size must be non-negative\")\n    return (\n        Path(tar_path).expanduser(),\n        offset,\n        size,\n        str(header.get(\"member\") or \"\") or None,\n    )\n\n\ndef _safe_suffix(value: str | None) -> str | None:\n    if not value:\n        return None\n    suffix = Path(urllib.parse.urlsplit(value).path).suffix.lower()\n    if suffix and len(suffix) <= 10 and suffix[1:].isalnum():\n        return suffix\n    return None\n\n\ndef _checked_material_file(path: Path, *, label: str) -> str:","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/material_io.py#L169-L205","documentation":"Raised when parsing a tar-member material URI for MiniMax H3: the header's offset_data and/or size parsed to a negative integer. The library refuses to build a byte-range read into the tar with negative bounds, since that would either read garbage or seek incorrectly.","triggerScenarios":"A material URI of the form referencing a tar member whose JSON header contains offset_data < 0 or size < 0 (e.g. hand-edited or generated by a buggy packaging step), passed to minimax_h3_localize_material_uri which streams via _stream_tar_member_material.","commonSituations":"Manually authored material manifests with typos (negative offsets), corrupted tar index files, or tooling that emits -1 as a sentinel for 'unknown' size.","solutions":["Inspect the header JSON in the material URI and fix offset_data/size to non-negative integers","Regenerate the tar material manifest with the packaging tool that produced it","If the sentinel -1 means 'unknown', recompute the real offset/size from the tar member header"],"exampleFix":"// before\n{\"tar\": \"/data/mats.tar\", \"offset_data\": -1, \"size\": -1}\n// after\n{\"tar\": \"/data/mats.tar\", \"offset_data\": 512, \"size\": 1048576}","handlingStrategy":"validation","validationCode":"import json\ndef valid_tar_header(uri_header: str) -> bool:\n    h = json.loads(uri_header)\n    off, size = int(h[\"offset_data\"]), int(h[\"size\"])\n    return off >= 0 and size >= 0","typeGuard":null,"tryCatchPattern":"try:\n    minimax_h3_localize_material_uri(uri)\nexcept ValueError as e:\n    if \"must be non-negative\" in str(e):\n        logging.error(\"bad tar header in %s\", uri)","preventionTips":["Generate tar-member URIs programmatically from tarfile member.offset_data/member.size","Never hand-edit offset/size fields in material manifests"],"tags":["minimax-h3","tar","material-uri","validation"],"backgroundTag":"invalid-manifest-field","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}