{"record":{"id":"111dcf3bcca0fa5d","repo":"sgl-project/sglang","slug":"reference-audio-start-time-must-be-non-negative","errorCode":null,"errorMessage":"reference audio start time must be non-negative","messagePattern":"reference audio start time 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/reference_encoding.py","lineNumber":232,"sourceCode":") -> tuple[torch.Tensor, int]:\n    \"\"\"Apply the audio material chain.\n\n    Pure-audio references preserve their source rate while normalizing to\n    stereo. Video-bearing references first extract 44.1 kHz stereo PCM. The\n    audio VAE boundary then performs the single 32 kHz resample below. ffmpeg\n    writes bounded interleaved float PCM directly to stdout, avoiding a\n    temporary lossless file plus a second decode.\n    \"\"\"\n\n    import numpy as np\n\n    if max_duration_seconds is not None:\n        max_duration_seconds = float(max_duration_seconds)\n        if not math.isfinite(max_duration_seconds) or max_duration_seconds <= 0:\n            raise ValueError(\"reference audio duration bound must be positive\")\n    start_time_seconds = float(start_time_seconds)\n    if not math.isfinite(start_time_seconds) or start_time_seconds < 0:\n        raise ValueError(\"reference audio start time must be non-negative\")\n\n    if material_chain == \"audio\":\n        if source_sample_rate is None or int(source_sample_rate) <= 0:\n            raise ValueError(\"reference audio sample rate must be positive\")\n        source_rate = int(source_sample_rate)\n    elif material_chain in {\n        \"video.reference_preserve\",\n        \"video_audio.reference_preserve\",\n    }:\n        source_rate = 44100\n    else:\n        raise ValueError(\n            f\"unsupported MiniMax H3 audio material chain {material_chain!r}\"\n        )\n\n    command = [\n        \"ffmpeg\",\n        \"-v\",","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/reference_encoding.py#L214-L250","documentation":"_load_waveform requires the audio clip start time to be a non-negative finite float. A negative start time would seek before the beginning of the media and is rejected before ffmpeg is invoked.","triggerScenarios":"Passing start_time_seconds < 0 or NaN to minimax_h3_encode_reference_audio_rows, e.g. from a sign error in timestamp math.","commonSituations":"Clip offsets computed as (marker - duration) underflowing below zero, or API users sending negative offsets to trim from the end.","solutions":["Clamp start times: start = max(0.0, start)","Treat negative offsets as offsets from the end and convert: start = max(0.0, total_duration + negative_offset)","Validate request timestamps server-side before the pipeline"],"exampleFix":"// before\nstart = marker_t - 5.0  # may go negative\n\n// after\nstart = max(0.0, marker_t - 5.0)","handlingStrategy":"validation","validationCode":"def valid_start(t) -> bool:\n    import math\n    return math.isfinite(t) and t >= 0","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp computed start times with max(0.0, x)","Validate user-supplied offsets at the API boundary"],"tags":["minimax-h3","audio","timestamp-validation"],"backgroundTag":"negative-timestamp","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}