sgl-project/sglang · error · RuntimeError

RPC error on {self._debug_name}: {response['error']}

Error message

RPC error on {self._debug_name}: {response['error']}

What it means

Raised by the debug-utils dumper RPC client when the remote side returns a response containing a non-null 'error' field. It wraps the remote error message with the debug name of the RPC endpoint so you can tell which service failed. It is a transport-level wrapper: the root cause text comes from whatever the serving process returned.

Source

Thrown at python/sglang/srt/debug_utils/dumper.py:1502

    def __init__(self, socket, debug_name: str):
        self._socket = socket
        self._debug_name = debug_name

    def __getattr__(self, method_name: str):
        def call(*args, **kwargs):
            sock_send(
                self._socket,
                wrap_as_pickle(
                    {
                        "method": method_name,
                        "args": args,
                        "kwargs": kwargs,
                    }
                ),
            )
            response = sock_recv(self._socket)
            if response["error"]:
                raise RuntimeError(
                    f"RPC error on {self._debug_name}: {response['error']}"
                )
            return response["result"]

        return call


class _RpcBroadcastBase:
    """Base for broadcasting method calls to dumper instance(s)."""

    def __getattr__(self, method_name: str):
        raise NotImplementedError

    def __init__(self, handles: List[_ZmqRpcHandle]):
        self._handles = handles


class _ZmqRpcBroadcast(_RpcBroadcastBase):

View on GitHub (pinned to 0132848349)

Solutions

  1. Inspect the text after 'RPC error on <name>:' — it contains the remote traceback; fix the underlying exception on the server side
  2. Verify the remote process is still alive and the socket was not recycled (reconnect if the pid restarted)
  3. Check that arguments you pass match what the remote handler expects in this sglang version
  4. If the error is intermittent, serialize calls or re-establish the RPC connection before retrying

Example fix

// before
result = proxy.capture_tensors()

// after
try:
    result = proxy.capture_tensors()
except RuntimeError as e:
    if 'RPC error on' in str(e):
        print('remote failed:', e)
        proxy = reconnect()
        result = proxy.capture_tensors()
    else:
        raise
Defensive patterns

Strategy: try-catch

Validate before calling

result = proxy.ping()  # cheap liveness RPC before the real call

Try / catch

try:
    result = proxy.call(...)
except RuntimeError as e:
    if 'RPC error on' not in str(e):
        raise
    log_remote_failure(e)
    proxy = reconnect()
    result = retry_call(proxy)

Prevention

When it happens

Trigger: Calling a method on an RPC proxy object created by this dumper module (e.g. proxy.fn(...)) where the remote handler raised an exception; the remote exception is serialized into response['error'] and re-raised locally as RuntimeError. Also triggered if the socket connection carries a malformed/stale response from a previous call.

Common situations: The debugged process crashed or raised inside the RPC handler (e.g. CUDA error, invalid tensor op); attaching to a dead or restarted process while reusing the old socket; calling an RPC method with invalid arguments for the remote API version.

Related errors


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