{"record":{"id":"03d146f7925073a9","repo":"sgl-project/sglang","slug":"launch-local-runtime-requires-dp-size-1-got-dp","errorCode":null,"errorMessage":"launch_local_runtime requires --dp-size 1; got dp_size={get_parallel().dp_size}.","messagePattern":"launch_local_runtime requires --dp-size 1; got dp_size=(.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/disaggregation/encoder/runtime.py","lineNumber":1496,"sourceCode":"    try:\n        configure_logger(server_args, prefix=f\" encode_dp_worker[{dp_rank}]\")\n        asyncio.run(\n            run_dp_worker(server_args, dp_rank, gpu_id, dispatch_path, result_path)\n        )\n    except KeyboardInterrupt:\n        logger.info(f\"DP worker {dp_rank} exiting\")\n    except Exception:\n        traceback.print_exc()\n\n\ndef launch_local_runtime(server_args: ServerArgs) -> EncoderRuntime:\n    \"\"\"Launch the current non-DP Scheduler and TP Encoder group.\n\n    This function owns backend construction only.  HTTP/gRPC middleware,\n    service registration, and network serving remain Transport concerns.\n    \"\"\"\n    if get_parallel().dp_size > 1:\n        raise ValueError(\n            \"launch_local_runtime requires --dp-size 1; got \"\n            f\"dp_size={get_parallel().dp_size}.\"\n        )\n\n    # Set up prometheus metrics.\n    if get_observability().enable_metrics:\n        set_prometheus_multiproc_dir()\n        labels = {\n            \"model_name\": get_serving().served_model_name,\n            \"dp_rank\": \"0\",\n        }\n        if get_observability().extra_metric_labels:\n            labels.update(get_observability().extra_metric_labels)\n        server_module.encoder_metrics_collector = EncoderMetricsCollector(labels)\n\n    process_context = mp.get_context(\"spawn\")\n    zmq_context = zmq.Context(10)\n    ipc_path_prefix = random_uuid()","sourceCodeStart":1478,"sourceCodeEnd":1514,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/disaggregation/encoder/runtime.py#L1478-L1514","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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","Set --dp-size 1 if you truly want the single scheduler + TP encoder topology","Inspect get_parallel() early in startup to confirm server_args were parsed as intended"],"exampleFix":"// before\nlaunch_local_runtime(...)  # with --dp-size 4\n// after\nlaunch_dp_runtime(...)     # with --dp-size 4 --tp-size 1","handlingStrategy":"validation","validationCode":"from sglang.srt import get_parallel\nassert get_parallel().dp_size == 1, 'use launch_dp_runtime when dp_size > 1'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Route entrypoint by dp_size: local for 1, DP for >1","Fail fast on startup with a config assertion","Document required flag combos per topology"],"tags":["startup","config","dp-size","parallelism"],"backgroundTag":"invalid-launch-configuration","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}