sgl-project/sglang · critical · ValueError

Intern-S2-Mobius requires at least one physical routed-exper

Error message

Intern-S2-Mobius requires at least one physical routed-expert bank

What it means

Raised when _get_mobius_routed_bank is called with an empty meta_mlp ModuleList. The routed-expert bank selection requires at least one physical bank to route to. This is an internal model-configuration invariant violation.

Source

Thrown at python/sglang/srt/models/interns2_mobius.py:386

            router_logits, _ = self.gate(hidden_states)
            topk_output = self.topk(hidden_states, router_logits)

        output = self.experts(hidden_states, topk_output)
        return output.reshape(original_shape)


def _mobius_reduce_combined_output(combined: torch.Tensor) -> torch.Tensor:
    """Apply the one ordinary TP reduction unless the scoped runtime owns it."""
    if get_parallel().tp_size > 1 and not should_skip_post_experts_all_reduce(
        is_tp_path=True
    ):
        return tensor_model_parallel_all_reduce(combined)
    return combined


def _get_mobius_routed_bank(meta_mlp: nn.ModuleList, layer_id: int) -> nn.Module:
    if not meta_mlp:
        raise ValueError(
            "Intern-S2-Mobius requires at least one physical routed-expert bank"
        )
    return meta_mlp[layer_id % len(meta_mlp)]


class _InternS2MobiusDecoderMixin:
    def _init_mobius_mlp(
        self,
        config: InternS2MobiusTextConfig,
        quant_config: QuantizationConfig | None,
        layer_prefix: str,
    ) -> None:
        self.mlp = InternS2MobiusLayerMlp(
            config=config,
            quant_config=quant_config,
            prefix=add_prefix("mlp", layer_prefix),
        )

View on GitHub (pinned to 0132848349)

Solutions

  1. Check the config used to build the model: ensure the routed-expert (MoE) fields produce at least one bank in meta_mlp
  2. Verify the checkpoint was converted for this model implementation (config key names may differ)
  3. Inspect where meta_mlp is populated in the model __init__ to confirm the gating condition

Example fix

// before
meta_mlp = nn.ModuleList(
    [build_bank(i) for i in range(config.num_banks) if keep(i)]  # keep() never true
)

// after
meta_mlp = nn.ModuleList(
    [build_bank(i) for i in range(max(1, config.num_banks))]
)
Defensive patterns

Strategy: validation

Validate before calling

assert len(meta_mlp) >= 1, "routed-expert bank list is empty; check config.mooe fields"

Type guard

def has_routed_bank(meta_mlp: nn.ModuleList) -> bool:
    return len(meta_mlp) > 0

Prevention

When it happens

Trigger: _forward_mobius_mlp calls _get_mobius_routed_bank(meta_mlp, layer_id) where meta_mlp is an empty nn.ModuleList — typically when the checkpoint/config declares routed experts but the module list was constructed empty (e.g., num_experts=0 or layer filter excluded all banks).

Common situations: Loading a converted Intern-S2-Mobius checkpoint with a mismatched config (moe settings stripped), editing the layer-building code and skipping bank creation, or a partially downloaded/quantized checkpoint.

Related errors


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