sgl-project/sglang · error · ValueError

Invalid endpoint: must contain 'inproc' or 'tcp'

Error message

Invalid endpoint: must contain 'inproc' or 'tcp'

What it means

offset_endpoint_port only knows how to offset ports for 'inproc' and 'tcp' ZMQ endpoints; any other transport string falls through to a ValueError. It offsets the port by the attention data-parallel rank so replicas bind sequential ports.

Source

Thrown at python/sglang/srt/disaggregation/kv_events.py:591

            The endpoint with the port offset by data_parallel_rank
                or suffix appended
        """
        # Do nothing if input is None or data_parallel_rank is 0
        if not endpoint or data_parallel_rank == 0:
            return endpoint

        if "inproc" in endpoint:
            return f"{endpoint}_dp{data_parallel_rank}"
        if "tcp" in endpoint:
            if endpoint and ":" in endpoint:
                # Get everything after the last colon (the port)
                last_colon_idx = endpoint.rfind(":")
                base_addr = endpoint[:last_colon_idx]
                base_port = int(endpoint[last_colon_idx + 1 :])
                new_port = base_port + data_parallel_rank
                return f"{base_addr}:{new_port}"
            return endpoint
        raise ValueError("Invalid endpoint: must contain 'inproc' or 'tcp'")


class KVEventsConfig(BaseModel):
    """Configuration for KV event publishing."""

    publisher: str = "null"
    """The publisher to use for publishing kv events. Can be "null", "zmq".
    """

    endpoint: str = "tcp://*:5557"
    """The zmq endpoint to use for publishing kv events.
    """

    replay_endpoint: Optional[str] = None
    """The zmq endpoint to use for replaying kv events.
    """

    buffer_steps: int = 10_000

View on GitHub (pinned to 0132848349)

Solutions

  1. Use a tcp://host:port (or inproc://...) endpoint for ZMQ-based publishers
  2. Extend the helper for your transport if you genuinely need non-tcp endpoints
  3. Ensure the endpoint contains a colon-separated trailing port so the offset arithmetic works

Example fix

// before
endpoint = "kafka-broker:9092"
# after
endpoint = "tcp://127.0.0.1:55557"
Defensive patterns

Strategy: validation

Validate before calling

scheme = endpoint.split("://", 1)[0] if "://" in endpoint else endpoint.split(":", 1)[0]
assert scheme in ("tcp", "inproc"), f"unsupported zmq endpoint scheme: {endpoint}"

Type guard

def is_offsettable_endpoint(ep: str) -> bool:
    return "tcp" in ep or "inproc" in ep and ep.rfind(":") != -1

Try / catch

catch ValueError from offset_endpoint_port at startup and fail fast with the offending endpoint in the message

Prevention

When it happens

Trigger: Calling KVEventsConfig publishers (e.g. Kafka/Radix publisher) whose endpoint string is not a zmq tcp:// or inproc:// address, with data_parallel_rank > 0, or passing endpoint without a parseable host:port.

Common situations: Setting a kafka bootstrap server like 'kafka:9092' as the ZMQ endpoint, or a custom transport added without extending this helper.

Related errors


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