sgl-project/sglang · error · ValueError
return_meta_info is not supported with streaming. Please set
Error message
return_meta_info is not supported with streaming. Please set stream=false when using return_meta_info=true.
What it means
return_meta_info=true is only supported for non-streaming /v1/chat/completions requests; meta info (finish details, usage internals, etc.) is attached to the complete GenerateOutput object. Streaming requests with this flag are rejected.
Source
Thrown at python/sglang/srt/entrypoints/openai/serving_chat.py:997
)
if reasoning_effort is not None:
request.reasoning_effort = reasoning_effort
if request.stream:
if request.return_prompt_token_ids:
raise ValueError(
"return_prompt_token_ids is not supported with streaming. "
"Please set stream=false when using return_prompt_token_ids=true."
)
if request.return_token_ids:
raise ValueError(
"return_token_ids is not supported with streaming on "
"/v1/chat/completions. Please set stream=false when using "
"return_token_ids=true."
)
if request.return_meta_info:
raise ValueError(
"return_meta_info is not supported with streaming. "
"Please set stream=false when using return_meta_info=true."
)
is_multimodal = self.tokenizer_manager.model_config.is_multimodal
# Process messages and apply chat template
processed_messages = self._process_messages(request, is_multimodal)
# Build sampling parameters
sampling_params = request.to_sampling_params(
stop=processed_messages.stop,
model_generation_config=self.default_sampling_params,
tool_call_constraint=processed_messages.tool_call_constraint,
renderer_handles_response_format=self.chat_encoding_spec == "kimi_k3",
)
# Handle single vs multiple requests
if request.input_ids is not None:View on GitHub (pinned to 0132848349)
Solutions
- Set stream=false when you need meta_info
- Or remove return_meta_info for streaming — finish_reason/usage still arrive via SSE events where supported
Example fix
// before
{"stream": true, "return_meta_info": true}
// after
{"stream": false, "return_meta_info": true} Defensive patterns
Strategy: validation
Validate before calling
if body.get("stream"):
body["return_meta_info"] = False Type guard
def stream_compat_ok(b): return not (b.get('stream') and b.get('return_meta_info')) Prevention
- Use SSE chunk metadata (finish_reason, usage events) instead of return_meta_info when streaming
When it happens
Trigger: POST /v1/chat/completions with {"stream": true, "return_meta_info": true}.
Common situations: Inspection/debug tooling built on the non-streaming API being switched to streaming; wanting per-chunk metadata like finish reason (which is already in SSE chunks).
Related errors
- return_prompt_token_ids is not supported with streaming. Ple
- return_token_ids is not supported with streaming on /v1/chat
- This use case is not supported. For OpenAI chat models, sgl.
- invalid reasoning effort: {effort!r}
- tool_choice 'required' or a named tool cannot be combined wi
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/4a434d78a78f32cf.
Report an issue: GitHub.