sgl-project/sglang · error · ValueError

Unsupported transport_mode: {transport_mode}

Error message

Unsupported transport_mode: {transport_mode}

What it means

Raised by the MMReceiver factory when transport_mode is not a key in _MM_RECEIVER_BY_MODE (only 'grpc' and 'http' are registered). This is the final guard after transport-mode/URL validation, catching unrecognized mode strings.

Source

Thrown at python/sglang/srt/disaggregation/encoder/receiver.py:2674

    dtype: Optional[torch.dtype] = None,
    hf_config: Optional[PretrainedConfig] = None,
    pp_rank: Optional[int] = None,
    tp_rank: Optional[int] = None,
    tp_group: Optional[GroupCoordinator] = None,
    scheduler: Optional["Scheduler"] = None,
    transport_mode: Optional[str] = None,
    encode_urls: Optional[List[str]] = None,
):
    if transport_mode is None:
        transport_mode = envs.SGLANG_ENCODER_MM_RECEIVER_MODE.get()
        logger.debug(f"MMReceiver transport_mode from env: {transport_mode}")

    _validate_transport_mode(transport_mode, encode_urls or get_disagg().encoder_urls)
    logger.info(f"EPD MMReceiver: using transport_mode={transport_mode}")

    receiver_cls = _MM_RECEIVER_BY_MODE.get(transport_mode)
    if receiver_cls is None:
        raise ValueError(f"Unsupported transport_mode: {transport_mode}")
    return receiver_cls(
        server_args,
        dtype=dtype,
        hf_config=hf_config,
        pp_rank=pp_rank,
        tp_rank=tp_rank,
        tp_group=tp_group,
        scheduler=scheduler,
        encode_urls=encode_urls,
    )

View on GitHub (pinned to 0132848349)

Solutions

  1. Set transport_mode / SGLANG_ENCODER_MM_RECEIVER_MODE to exactly 'grpc' or 'http'.
  2. Check for typos, casing, and whitespace in the env var value.
  3. Unset the env var to let the mode be inferred from encoder URL schemes.

Example fix

# before
SGLANG_ENCODER_MM_RECEIVER_MODE=HTTP
# after
SGLANG_ENCODER_MM_RECEIVER_MODE=http
Defensive patterns

Strategy: validation

Validate before calling

VALID_MODES = {"grpc", "http"}
mode = (transport_mode or "").strip().lower()
assert mode in VALID_MODES, f"transport_mode must be one of {VALID_MODES}, got {transport_mode!r}"

Type guard

def is_valid_transport_mode(mode) -> bool:
    return isinstance(mode, str) and mode.strip().lower() in {"grpc", "http"}

Try / catch

try:
    receiver = create_mm_receiver(server_args, transport_mode=mode)
except ValueError as e:
    raise SystemExit(f"bad SGLANG_ENCODER_MM_RECEIVER_MODE: {e}") from e

Prevention

When it happens

Trigger: Passing transport_mode values like 'zmq', 'tcp', 'HTTPS' (case mismatch), or None-with-typo to the receiver factory; typically derived from SGLANG_ENCODER_MM_RECEIVER_MODE env var or an explicit argument.

Common situations: Typos or case errors in SGLANG_ENCODER_MM_RECEIVER_MODE; assuming a transport mode exists (e.g. 'mooncake' or 'rdma') that is not a receiver mode; stale docs or copied configs naming a removed mode.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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