sgl-project/sglang · error · ValueError
HTTP material body is empty: {uri}
Error message
HTTP material body is empty: {uri} What it means
The HTTP(S) material download completed but zero body bytes were read, so the asset would be an empty file. The downloader refuses to cache an empty body.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/material_io.py:752
/ f"condition_{int(condition_index):04d}{suffix}"
)
partial_path = output_path.with_name(output_path.name + ".partial")
total = 0
try:
with partial_path.open("wb") as output:
while True:
chunk = response.read(MINIMAX_H3_HTTP_READ_CHUNK_BYTES)
if not chunk:
break
if not isinstance(chunk, bytes):
raise TypeError(
"HTTP material response.read() must return bytes, got "
f"{type(chunk).__name__}"
)
total += len(chunk)
output.write(chunk)
if total == 0:
raise ValueError(f"HTTP material body is empty: {uri}")
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 minimax_h3_localize_material_uri(
batch: Any,
uri: str,
*,
condition_type: str,
condition_index: int,
timeout_s: float = 120.0,
) -> str:
"""Return a local path for a canonical condition URI.
View on GitHub (pinned to 0132848349)
Solutions
- curl -i the URL and inspect status/body
- Regenerate the pre-signed URL or fix the object key
- Check proxy/CDN interference for the host
Defensive patterns
Strategy: validation
Validate before calling
import urllib.request
with urllib.request.urlopen(uri) as r:
assert r.read(1), 'empty body' # precheck Try / catch
except ValueError as e:
if 'empty' in str(e): refresh pre-signed URL and retry Prevention
- Pre-check URLs for expensive batches
- Monitor for expired signed URLs
When it happens
Trigger: The URL returns 200 with an empty body, or a redirect/proxy returns an empty page; total == 0 after the read loop in _stream_http_material.
Common situations: Expired pre-signed URL that yields an empty 200, misconfigured object-storage endpoint, CDN edge returning empty body, wrong URL.
Related errors
- Failed to get server info. {error_data['error']['message']}
- Failed to edit image: {str(e)}
- Failed to generate image: {str(e)}
- Failed to generate video: {str(e)}
- No image data in response
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/1043920f2b523844.
Report an issue: GitHub.