sgl-project/sglang · error · ValueError

DFLASH requires explicit layer_ids for aux hidden capture.

Error message

DFLASH requires explicit layer_ids for aux hidden capture.

What it means

DFLASH aux-hidden capture on Qwen3-Next requires explicit layer ids; None is rejected before enabling capture_aux_hidden_states.

Source

Thrown at python/sglang/srt/models/qwen3_next.py:1285

        self.capture_aux_hidden_states = True
        if layer_ids is None:
            num_layers = self.config.num_hidden_layers
            self.model.set_eagle3_layers_to_capture(
                [
                    2,
                    num_layers // 2,
                    num_layers - 3,
                ]
            )  # Specific layers for EAGLE3 support
        else:
            self.model.set_eagle3_layers_to_capture([val + 1 for val in layer_ids])

    def set_dflash_layers_to_capture(self, layer_ids: list[int]):
        if not self.pp_group.is_last_rank:
            return

        if layer_ids is None:
            raise ValueError(
                "DFLASH requires explicit layer_ids for aux hidden capture."
            )

        self.capture_aux_hidden_states = True
        self.model.set_dflash_layers_to_capture([val + 1 for val in layer_ids])


EntryClass = Qwen3NextForCausalLM

View on GitHub (pinned to 0132848349)

Solutions

  1. Set explicit capture layers (--dflash-capture-layers or equivalent)
  2. Ensure the spec-decoding worker computes and forwards layer indices

Example fix

# before
model.set_dflash_layers_to_capture(None)
# after
model.set_dflash_layers_to_capture([0, 2, 4])
Defensive patterns

Strategy: validation

Validate before calling

assert layer_ids, "DFLASH requires --dflash-capture-layers"

Prevention

When it happens

Trigger: Calling Qwen3NextForCausalLM.set_dflash_layers_to_capture(None) on the last pipeline rank while setting up DFLASH speculative decoding.

Common situations: DFLASH enabled without a capture-layer list in server args or speculative config for Qwen3-Next.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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