sgl-project/sglang · critical · ValueError

launch_local_runtime requires --dp-size 1; got dp_size={get_

Error message

launch_local_runtime requires --dp-size 1; got dp_size={get_parallel().dp_size}.

What it means

launch_local_runtime constructs a single (non-DP) scheduler plus TP encoder group and therefore requires --dp-size 1; if the process-wide parallel config reports dp_size > 1 it raises ValueError immediately at startup.

Source

Thrown at python/sglang/srt/disaggregation/encoder/runtime.py:1496

    try:
        configure_logger(server_args, prefix=f" encode_dp_worker[{dp_rank}]")
        asyncio.run(
            run_dp_worker(server_args, dp_rank, gpu_id, dispatch_path, result_path)
        )
    except KeyboardInterrupt:
        logger.info(f"DP worker {dp_rank} exiting")
    except Exception:
        traceback.print_exc()


def launch_local_runtime(server_args: ServerArgs) -> EncoderRuntime:
    """Launch the current non-DP Scheduler and TP Encoder group.

    This function owns backend construction only.  HTTP/gRPC middleware,
    service registration, and network serving remain Transport concerns.
    """
    if get_parallel().dp_size > 1:
        raise ValueError(
            "launch_local_runtime requires --dp-size 1; got "
            f"dp_size={get_parallel().dp_size}."
        )

    # Set up prometheus metrics.
    if get_observability().enable_metrics:
        set_prometheus_multiproc_dir()
        labels = {
            "model_name": get_serving().served_model_name,
            "dp_rank": "0",
        }
        if get_observability().extra_metric_labels:
            labels.update(get_observability().extra_metric_labels)
        server_module.encoder_metrics_collector = EncoderMetricsCollector(labels)

    process_context = mp.get_context("spawn")
    zmq_context = zmq.Context(10)
    ipc_path_prefix = random_uuid()

View on GitHub (pinned to 0132848349)

Solutions

  1. Use launch_dp_runtime (the DP dispatcher path) when dp_size > 1 — usually just let launch_server pick it, or pass the DP entrypoint flag
  2. Set --dp-size 1 if you truly want the single scheduler + TP encoder topology
  3. Inspect get_parallel() early in startup to confirm server_args were parsed as intended

Example fix

// before
launch_local_runtime(...)  # with --dp-size 4
// after
launch_dp_runtime(...)     # with --dp-size 4 --tp-size 1
Defensive patterns

Strategy: validation

Validate before calling

from sglang.srt import get_parallel
assert get_parallel().dp_size == 1, 'use launch_dp_runtime when dp_size > 1'

Prevention

When it happens

Trigger: Starting the disaggregated encoder service with --dp-size 2 or higher but invoking the local (non-DP) runtime path — i.e. the launch code routed to launch_local_runtime instead of launch_dp_runtime.

Common situations: Copying a TP-only launch command while keeping a larger dp_size flag; a launcher/entrypoint that defaults to local runtime regardless of dp_size after a version change; misconfigured server_args parsed from a config file.

Related errors


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