sgl-project/sglang · error · ValueError

Streaming sessions are disabled. Please relaunch with --enab

Error message

Streaming sessions are disabled. Please relaunch with --enable-streaming-session.

What it means

open_session raises when a client requests a streaming session (obj.streaming=True) but the server was not launched with --enable-streaming-session.

Source

Thrown at python/sglang/srt/managers/tokenizer_control_mixin.py:909

        reader = self.load_snapshot_reader
        if dp_rank is not None:
            load = reader.read(dp_rank)
            results = [load] if load is not None else []
        else:
            results = reader.read_all()

        return results

    async def open_session(
        self: TokenizerManager,
        obj: OpenSessionReqInput,
        request: Optional[fastapi.Request] = None,
    ):
        self.auto_create_handle_loop()
        if obj.streaming:
            if not self.server_args.enable_streaming_session:
                raise ValueError(
                    "Streaming sessions are disabled. "
                    "Please relaunch with --enable-streaming-session."
                )

        if obj.session_id is None:
            obj.session_id = uuid.uuid4().hex
        elif obj.session_id in self.session_futures:
            return None

        future = asyncio.Future()
        self.session_futures[obj.session_id] = future
        self._dispatch_to_scheduler(obj)

        try:
            return await future
        finally:
            self.session_futures.pop(obj.session_id, None)

View on GitHub (pinned to 0132848349)

Solutions

  1. Relaunch the server with --enable-streaming-session
  2. Or open the session non-streaming (streaming=False) if streaming isn't required

Example fix

# before
python -m sglang.launch_server --model-path ...
# after
python -m sglang.launch_server --model-path ... --enable-streaming-session
Defensive patterns

Strategy: validation

Validate before calling

if obj.streaming and not server_info.get('enable_streaming_session'):
    obj.streaming = False  # or fail with a clear config error

Try / catch

try:
    await client.open_session(obj)
except ValueError as e:
    if 'enable-streaming-session' in str(e):
        obj.streaming = False
        return await client.open_session(obj)
    raise

Prevention

When it happens

Trigger: Calling the session API with streaming=True on a server without --enable-streaming-session.

Common situations: Client SDK defaults requesting streaming sessions; older launch scripts missing the new flag.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/196bb6008c95c047. Report an issue: GitHub.