sgl-project/sglang · error · ValueError
DSpark with dp attention + moe_a2a_backend={} requires SGLAN
Error message
DSpark with dp attention + moe_a2a_backend={} requires SGLANG_RAGGED_VERIFY_MODE=static. What it means
When DSpark runs with dp attention and a non-'none' MoE a2a backend (i.e. megamoe) on CUDA, the ragged verification path must be in static mode. The hook reads SGLANG_RAGGED_VERIFY_MODE via read_ragged_verify_mode() and rejects anything other than STATIC.
Source
Thrown at python/sglang/srt/arg_groups/speculative_hook.py:372
# dp_size==1 with dp_attention is a degenerate flag under DSV4 CP; skip DP-only checks.
if cfg.enable_dp_attention and cfg.dp_size > 1:
if not cfg.enable_dp_lm_head:
raise ValueError("DSpark with dp attention requires --enable-dp-lm-head.")
if not _is_npu and cfg.moe_a2a_backend not in ("none", "megamoe"):
raise ValueError(
"DSpark with dp attention supports moe_a2a_backend 'none' "
"(built-in TP MoE) or 'megamoe', got "
f"{cfg.moe_a2a_backend!r}."
)
if not _is_npu and cfg.moe_a2a_backend != "none":
from sglang.srt.speculative.ragged_verify import (
RaggedVerifyMode,
read_ragged_verify_mode,
)
if read_ragged_verify_mode() is not RaggedVerifyMode.STATIC:
raise ValueError(
"DSpark with dp attention + "
f"moe_a2a_backend={cfg.moe_a2a_backend!r} requires "
"SGLANG_RAGGED_VERIFY_MODE=static."
)
if cfg.attn_cp_size > 1:
raise ValueError(
"DSpark with dp attention does not support context parallel "
f"(attn_cp_size={cfg.attn_cp_size})."
)
if (
not _is_npu
and cfg.speculative_moe_a2a_backend is not None
and cfg.speculative_moe_a2a_backend != cfg.moe_a2a_backend
):
raise ValueError(
"DSpark ignores --speculative-moe-a2a-backend; with dp attention it "
f"must match the target moe_a2a_backend={cfg.moe_a2a_backend!r} "
f"(got {cfg.speculative_moe_a2a_backend!r})."View on GitHub (pinned to 0132848349)
Solutions
- Export SGLANG_RAGGED_VERIFY_MODE=static before launching
- Keep --moe-a2a-backend none to avoid the requirement entirely
- Add the env var to your container/systemd/k8s service definition so it persists
Example fix
# before SGLANG_RAGGED_VERIFY_MODE=dynamic python -m sglang.launch_server ... # after SGLANG_RAGGED_VERIFY_MODE=static python -m sglang.launch_server ...
Defensive patterns
Strategy: validation
Validate before calling
import os
if args.enable_dp_attention and args.dp_size > 1 and args.moe_a2a_backend not in ('none',):
if os.environ.get('SGLANG_RAGGED_VERIFY_MODE', '').lower() != 'static':
raise SystemExit('export SGLANG_RAGGED_VERIFY_MODE=static first') Prevention
- Bake SGLANG_RAGGED_VERIFY_MODE=static into container images used for DSpark + megamoe
When it happens
Trigger: DSpark + dp attention (dp_size>1) + moe_a2a_backend=megamoe while the env var SGLANG_RAGGED_VERIFY_MODE is unset or set to a non-static value.
Common situations: Fresh shell/container where SGLANG_RAGGED_VERIFY_MODE was never exported; the var set to 'dynamic' by an experimental preset.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- Kimi-K3 DCP + DSPARK currently requires SGLANG_RAGGED_VERIFY
- DSpark with dp attention supports moe_a2a_backend 'none' (bu
- DSpark ignores --speculative-moe-a2a-backend; with dp attent
- DSV4 ragged verify does not support context parallel (CP); s
- DSpark speculative decoding only supports CUDA or NPU device
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/315603c12a4a672c.
Report an issue: GitHub.