sgl-project/sglang · error · ValueError
material URI decoded payload is empty
Error message
material URI decoded payload is empty
What it means
After decoding, the computed decoded size ((encoded_size*3)//4 - padding) is zero or negative, meaning the payload carried no actual bytes (e.g. only padding like '====' slipped through earlier checks).
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/material_io.py:637
raise ValueError("material URI has data after base64 padding")
encoded_chunk.append(value)
if len(encoded_chunk) == MINIMAX_H3_BASE64_DECODE_CHUNK_CHARS:
decoded_chunk = _decode_base64_chunk(encoded_chunk)
total += len(decoded_chunk)
output.write(decoded_chunk)
encoded_chunk.clear()
if encoded_size == 0:
raise ValueError("material URI base64 payload is empty")
if encoded_size % 4 == 1 or (padding and encoded_size % 4):
raise ValueError("material URI has an invalid base64 payload length")
if encoded_chunk:
encoded_chunk.extend(b"=" * (-len(encoded_chunk) % 4))
decoded_chunk = _decode_base64_chunk(encoded_chunk)
total += len(decoded_chunk)
output.write(decoded_chunk)
decoded_size = (encoded_size * 3) // 4 - padding
if decoded_size <= 0:
raise ValueError("material URI decoded payload is empty")
if total != decoded_size:
raise ValueError(
f"MiniMax H3 base64 decoded size {total} != expected {decoded_size}"
)
partial_path.replace(output_path)
except Exception:
partial_path.unlink(missing_ok=True)
output_path.unlink(missing_ok=True)
raise
return str(output_path)
def _stream_tar_member_material(
batch: Any,
uri: str,
*,
condition_type: str,
condition_index: int,View on GitHub (pinned to 0132848349)
Solutions
- Regenerate the data URI from the real asset
- Validate decoded length > 0 before submission
- Check for double-encoding bugs that strip content but keep padding
Defensive patterns
Strategy: validation
Validate before calling
decoded = base64.b64decode(payload + '=' * (-len(payload) % 4)) assert decoded, 'decodes to empty'
Prevention
- Verify decoded byte length > 0 before submission
When it happens
Trigger: A payload consisting solely of '=' characters, or encoded_size so small relative to padding that decoded_size <= 0.
Common situations: Corrupted data URI where the real payload was lost but padding remains; test fixtures with placeholder base64.
Related errors
- data URI must use ;base64 encoding
- material URI base64 payload must be ASCII
- material URI has an invalid base64 character {character!r}
- tar material URI has an invalid encoded header
- material URI has an invalid base64 payload
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/5d2207403d12efeb.
Report an issue: GitHub.