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_000View on GitHub (pinned to 0132848349)
Solutions
- Use a tcp://host:port (or inproc://...) endpoint for ZMQ-based publishers
- Extend the helper for your transport if you genuinely need non-tcp endpoints
- 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
- Validate kv-events endpoints in config parsing before launch
- Document that only zmq tcp/inproc endpoints are offsettable
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
- {field_name} is required
- {field_name} must be formatted as tcp://host:port or host:po
- {field_name} must include both host and port: {value!r}
- {field_name} port must be an integer: {port_str}
- {field_name} port must be between 0 and 65535: {port}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/a58138b69d3b92d8.
Report an issue: GitHub.