sgl-project/sglang · error · ValueError
Dots note omni expanded prompt is too long: {len(input_ids)}
Error message
Dots note omni expanded prompt is too long: {len(input_ids)} > {max_req_input_len} What it means
Raised by process_mm_data_async after expanding multimodal tokens into input_ids: the fully expanded prompt exceeds the request's maximum input length (max_req_input_len), so the request would be unschedulable.
Source
Thrown at python/sglang/srt/multimodal/processors/dots_note_omni.py:553
item_start = len(input_ids)
input_ids.extend(item_token_ids)
local_offsets = self.get_mm_items_offset(
torch.tensor(item_token_ids), pad_token_id
)
offsets = [
(item_start + start, item_start + end) for start, end in local_offsets
]
item = MultimodalDataItem(
modality=modality,
feature=feature,
offsets=offsets,
model_specific_data=model_specific_data,
)
item.set_pad_value()
mm_items.append(item)
if len(input_ids) > max_req_input_len:
raise ValueError(
"Dots note omni expanded prompt is too long: "
f"{len(input_ids)} > {max_req_input_len}"
)
padded_input_ids = MultimodalProcessorOutput.build_padded_input_ids(
input_ids, mm_items
)
return MultimodalProcessorOutput(
mm_items=mm_items,
input_ids=input_ids,
padded_input_ids=padded_input_ids,
**self.mm_token_ids,
)
View on GitHub (pinned to 0132848349)
Solutions
- Shorten/trim the video (fewer frames, lower resolution) or reduce the number of media items
- Raise the server context length (--context-length) if the model supports it
- Reduce sampling_params.max_new_tokens so seq_length = seq - max_new_tokens leaves more room for input
Example fix
# before
video_config = {"seq": 131072}
sampling_params = {"max_new_tokens": 120000} # leaves 11108 for video tokens
# after
sampling_params = {"max_new_tokens": 1024} # leaves ~130k for input Defensive patterns
Strategy: validation
Validate before calling
est_tokens = estimate_expanded_tokens(video, images, prompt) # frames * per-frame tokens + text
assert est_tokens <= max_req_input_len, f'estimated {est_tokens} > {max_req_input_len}' Try / catch
try:
await processor.process_mm_data_async(...)
except ValueError as e:
if 'expanded prompt is too long' in str(e):
# trim video frames/resolution or lower max_new_tokens, then resubmit Prevention
- Estimate media token cost before sending long videos
- Keep max_new_tokens modest relative to seq/context length
When it happens
Trigger: A video (plus images/audio/text) expands to more token ids than max_req_input_len — long videos are the usual cause since keyframes consume thousands of tokens each; e.g. seq budget misconfigured so seq_length = seq - max_new_tokens is too small for the media.
Common situations: Sending long/high-fps videos, many videos in one prompt, or setting a small context length (--context-length) while seq defaults assume 131072. The check runs after all padding-relevant items are built.
Related errors
- seq must be positive, got {seq}
- max_new_tokens must be non-negative, got {max_new_tokens}
- max_new_tokens must leave room for input: max_new_tokens={ma
- audio_cap must be non-negative, got {audio_cap}
- audio_sr must be positive, got {audio_sr}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/d35d6faf6832b667.
Report an issue: GitHub.