sgl-project/sglang · error · ValueError

Global server args is not set yet!

Error message

Global server args is not set yet!

What it means

Error "Global server args is not set yet!" thrown in sgl-project/sglang.

Source

Thrown at python/sglang/srt/runtime_context.py:804

        return stream

    def get_buffer(self, name: str, factory: Any) -> Any:
        """Named process-level persistent buffer: get-or-create via
        ``factory()``, shared by name (the keyed-lazy pattern of the
        persistent buffers / named streams)."""
        buf = self.resources.buffers.get(name)
        if buf is None:
            buf = factory()
            self.resources.buffers[name] = buf
        return buf

    @property
    def server_args(self) -> ServerArgs:
        """The process-wide ``ServerArgs`` (context-owned slot)."""
        server_args = self._server_args
        if server_args is None:
            # Verbatim legacy message: tests and user scripts may match on it.
            raise ValueError("Global server args is not set yet!")
        return server_args

    def set_server_args(self, server_args: ServerArgs) -> None:
        """Publish the process-wide ``ServerArgs`` into the context-owned slot.

        Overwrite-allowed: a re-publish replaces the slot (test kits re-publish
        per test; production ordering discipline lives at the call-sites, e.g.
        the draft-worker guard in ``ModelRunner.__init__``). The published
        object is the raw input; the resolution it carries is its declaration
        stash, which is what the bags are projected from.
        """
        # Seed the capture tier for the new lifecycle (defaults for sentinel
        # and mock publishes, which carry no config).
        self.flags.capture.enable_torch_compile = getattr(
            server_args, "enable_torch_compile", False
        )
        self._server_args = server_args
        # The adaptive draft-token bound memoizes on the config *path*, so a new

View on GitHub (pinned to 0132848349)

When it happens

Trigger: Thrown at python/sglang/srt/runtime_context.py:804 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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