sgl-project/sglang · error · ValueError

tar material payload is truncated: expected {size} bytes, on

Error message

tar material payload is truncated: expected {size} bytes, only {available} available

What it means

The tar file is smaller than the declared member offset+size, i.e. the pre-flight bounds check against source file stat size failed. The archive cannot contain the requested byte range.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/material_io.py:667

def _stream_tar_member_material(
    batch: Any,
    uri: str,
    *,
    condition_type: str,
    condition_index: int,
) -> str:
    source_path, offset, size, member = _parse_tar_member_uri(uri)
    if size <= 0:
        raise ValueError("tar material payload is empty")
    if not source_path.is_file():
        raise FileNotFoundError(
            f"tar material source does not exist or is not a file: {source_path}"
        )
    source_size = source_path.stat().st_size
    if offset > source_size or size > source_size - offset:
        available = max(0, source_size - offset)
        raise ValueError(
            f"tar material payload is truncated: expected {size} bytes, "
            f"only {available} available"
        )

    output_path, partial_path = _material_output_paths(
        batch,
        condition_type=condition_type,
        condition_index=condition_index,
        source_name=member,
    )
    remaining = size
    try:
        with source_path.open("rb") as source, partial_path.open("wb") as output:
            source.seek(offset)
            while remaining:
                chunk = source.read(min(MINIMAX_H3_HTTP_READ_CHUNK_BYTES, remaining))
                if not chunk:
                    raise ValueError(

View on GitHub (pinned to 0132848349)

Solutions

  1. Re-download or restore the full tar archive and compare its size/checksum
  2. Regenerate the tar-member URIs against the current archive
  3. Verify no process is rewriting the tar concurrently
Defensive patterns

Strategy: validation

Validate before calling

st = source.stat().st_size
assert 0 <= offset and 0 < size <= st - offset, 'range outside archive'

Try / catch

except ValueError as e: re-fetch/regenerate the archive and URI

Prevention

When it happens

Trigger: A tar-member URI whose offset/size exceed source_path.stat().st_size — e.g. the tar was replaced with an older/smaller file after the URI was minted.

Common situations: Truncated upload/download of the tar, partial rsync copy, or stale URI generated against a different (larger) version of the archive.

Related errors


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