{"record":{"id":"d35d6faf6832b667","repo":"sgl-project/sglang","slug":"dots-note-omni-expanded-prompt-is-too-long-len-i","errorCode":null,"errorMessage":"Dots note omni expanded prompt is too long: {len(input_ids)} > {max_req_input_len}","messagePattern":"Dots note omni expanded prompt is too long: (.+?) > (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/processors/dots_note_omni.py","lineNumber":553,"sourceCode":"            item_start = len(input_ids)\n            input_ids.extend(item_token_ids)\n            local_offsets = self.get_mm_items_offset(\n                torch.tensor(item_token_ids), pad_token_id\n            )\n            offsets = [\n                (item_start + start, item_start + end) for start, end in local_offsets\n            ]\n            item = MultimodalDataItem(\n                modality=modality,\n                feature=feature,\n                offsets=offsets,\n                model_specific_data=model_specific_data,\n            )\n            item.set_pad_value()\n            mm_items.append(item)\n\n        if len(input_ids) > max_req_input_len:\n            raise ValueError(\n                \"Dots note omni expanded prompt is too long: \"\n                f\"{len(input_ids)} > {max_req_input_len}\"\n            )\n        padded_input_ids = MultimodalProcessorOutput.build_padded_input_ids(\n            input_ids, mm_items\n        )\n        return MultimodalProcessorOutput(\n            mm_items=mm_items,\n            input_ids=input_ids,\n            padded_input_ids=padded_input_ids,\n            **self.mm_token_ids,\n        )\n","sourceCodeStart":535,"sourceCodeEnd":566,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/processors/dots_note_omni.py#L535-L566","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nvideo_config = {\"seq\": 131072}\nsampling_params = {\"max_new_tokens\": 120000}  # leaves 11108 for video tokens\n# after\nsampling_params = {\"max_new_tokens\": 1024}  # leaves ~130k for input","handlingStrategy":"validation","validationCode":"est_tokens = estimate_expanded_tokens(video, images, prompt)  # frames * per-frame tokens + text\nassert est_tokens <= max_req_input_len, f'estimated {est_tokens} > {max_req_input_len}'","typeGuard":null,"tryCatchPattern":"try:\n    await processor.process_mm_data_async(...)\nexcept ValueError as e:\n    if 'expanded prompt is too long' in str(e):\n        # trim video frames/resolution or lower max_new_tokens, then resubmit","preventionTips":["Estimate media token cost before sending long videos","Keep max_new_tokens modest relative to seq/context length"],"tags":["multimodal","context-length","prompt-too-long","valueerror"],"backgroundTag":"context-length-exceeded","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}