sgl-project/sglang · error · ValueError
DeepSeekV4 CP supports moe_a2a_backend in {supported_a2a_bac
Error message
DeepSeekV4 CP supports moe_a2a_backend in {supported_a2a_backends}, got {cfg.moe_a2a_backend!r}. What it means
When DeepSeek V4 runs with prefill context parallelism, the MoE all-to-all backend must be one of none, deepep, megamoe, or mori because only these backends have correct collective/precision behavior under CP for this model. Any other moe_a2a_backend is rejected.
Source
Thrown at python/sglang/srt/arg_groups/deepseek_v4_hook.py:209
declare_resolution(
server_args,
"validate_deepseek_v4_cp",
moe_dense_tp_size=1,
)
declare_resolution(
server_args,
"validate_deepseek_v4_cp",
attn_cp_size=cfg.tp_size // cfg.dp_size,
)
assert (
cfg.dp_size == 1
), "For round-robin split mode, dp attention is not supported."
assert (
cfg.tp_size <= 8
), "Context parallel only supports single machine (tp_size <= 8). Cross-machine CP has precision issues."
supported_a2a_backends = ("none", "deepep", "megamoe", "mori")
if cfg.moe_a2a_backend not in supported_a2a_backends:
raise ValueError(
f"DeepSeekV4 CP supports moe_a2a_backend in {supported_a2a_backends}, "
f"got {cfg.moe_a2a_backend!r}."
)
logger.warning(
"Disabling SGLANG_OPT_FLASHMLA_SPARSE_PREFILL because DeepSeekV4 "
"context parallelism is enabled."
)
envs.SGLANG_OPT_FLASHMLA_SPARSE_PREFILL.set(False)
logger.warning(
f"Enable Context Parallel for DeepSeekV4, "
f"dp_size={cfg.dp_size}, moe_dense_tp_size={cfg.moe_dense_tp_size}, "
f"attn_cp_size={cfg.attn_cp_size}, ep_size={cfg.ep_size}, tp_size={cfg.tp_size}"
)
View on GitHub (pinned to 0132848349)
Solutions
- Set --moe-a2a-backend to one of none, deepep, megamoe, or mori
- Remove the explicit --moe-a2a-backend flag to use the default
- If you need a specific backend, disable --enable-prefill-cp
Example fix
# before --enable-prefill-cp --moe-a2a-backend some_backend # after --enable-prefill-cp --moe-a2a-backend deepep
Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED = {"none", "deepep", "megamoe", "mori"}
if getattr(cfg, 'enable_prefill_cp', False) and cfg.moe_a2a_backend not in SUPPORTED:
server_args.moe_a2a_backend = 'deepep' Try / catch
except ValueError as e:
if 'moe_a2a_backend' in str(e): server_args.moe_a2a_backend = 'deepep'
else: raise Prevention
- Keep DeepSeek V4 CP launch templates with an explicit supported --moe-a2a-backend
- Validate the tuple in config-management code before server start
When it happens
Trigger: DeepSeek V4 + enable_prefill_cp with cfg.moe_a2a_backend outside ("none", "deepep", "megamoe", "mori") — e.g. "flashinfer_tkv" or another a2a backend — during _handle_model_specific_adjustments.
Common situations: Reusing an a2a backend tuned for a different model/cluster, or a launcher template that sets --moe-a2a-backend unconditionally; also defaulting to a backend not yet ported to CP paths.
Related errors
- DeepSeekV4 only supports interleave CP strategy, got {cfg.cp
- DSpark with dp attention supports moe_a2a_backend 'none' (bu
- DSpark ignores --speculative-moe-a2a-backend; with dp attent
- DSA indexer weights_proj LoRA is incompatible with piecewise
- DSA indexer only supports CUDA, HIP, and NPU
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/393f0aae4681fa03.
Report an issue: GitHub.