sgl-project/sglang · error · ValueError
keyframe payload requires an integer frame_count
Error message
keyframe payload requires an integer frame_count
What it means
keyframe['frame_count'] must be a real int (bools explicitly rejected) describing the post-alignment frame count of the conditioned video.
Source
Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/denoising.py:106
)
return
if keyframe is None:
if task == "fl2va":
raise ValueError("fl2va denoising requires encoded keyframe condition rows")
return
if not isinstance(keyframe, Mapping):
raise ValueError("encoded keyframe condition rows must be a mapping")
semantic_indices = tuple(keyframe.get("semantic_frame_indices") or ())
if semantic_indices not in MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES:
raise ValueError(
"keyframe denoising requires semantic_frame_indices in "
f"{MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES!r}, "
f"got {semantic_indices!r}"
)
frame_count = keyframe.get("frame_count")
if isinstance(frame_count, bool) or not isinstance(frame_count, int):
raise ValueError("keyframe payload requires an integer frame_count")
if frame_count <= 1:
raise ValueError("keyframe payload frame_count must be greater than one")
pixel_indices = keyframe.get("pixel_frame_indices")
expected_pixel_indices = [
frame_count - 1 if index == -1 else index for index in semantic_indices
]
if pixel_indices != expected_pixel_indices:
raise ValueError(
"keyframe denoising requires pixel_frame_indices resolved from the "
"semantic anchors, "
f"got {pixel_indices!r} for frame_count={frame_count}"
)
entries = keyframe.get("keyframes")
if (
not isinstance(entries, list)
or len(entries) != len(semantic_indices)
or any(not isinstance(entry, Mapping) for entry in entries)View on GitHub (pinned to 0132848349)
Solutions
- Coerce with int(...) when building the payload (guarding against bool)
- Convert numpy integers via int() before attaching
- Ensure the field is always set by the producing stage
Example fix
# before payload["frame_count"] = float(n_frames) # after payload["frame_count"] = int(n_frames)
Defensive patterns
Strategy: type-guard
Validate before calling
fc = keyframe.get("frame_count")
assert not isinstance(fc, bool) and isinstance(fc, int) Type guard
def is_int_frame_count(v) -> bool:
return not isinstance(v, bool) and isinstance(v, int) Prevention
- Coerce numpy ints to int() when building payloads
- Never store frame_count as float/str
When it happens
Trigger: frame_count missing (None), a float like 129.0, a string "129", or a boolean sneaking in from JSON/flag code.
Common situations: JSON deserialization producing strings/floats; numpy integer types not matching isinstance(int); a bool used as a 1/0 flag in the payload.
Related errors
- encoded keyframe condition rows must be a mapping
- keyframe payload frame_count must be greater than one
- keyframe denoising requires one encoded keyframe per semanti
- subblock_sparse_query_block_mask must be a tensor
- strict fl2va packed layout requires integer keyframe_frame_i
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/8b3f424699eacc1a.
Report an issue: GitHub.