sgl-project/sglang · error · ValueError

--linear-attn-decode-backend flashkda is not supported: Flas

Error message

--linear-attn-decode-backend flashkda is not supported: FlashKDA is prefill-only. Use --linear-attn-prefill-backend flashkda (decode stays on triton).

What it means

FlashKDA is a prefill-only linear-attention kernel; it has no decode implementation, so explicitly selecting it as the decode backend is rejected. The message tells you to use it only for prefill — decode then stays on triton.

Source

Thrown at python/sglang/srt/server_args.py:6861

                "_handle_linear_attn_backend",
                linear_attn_decode_backend="flashinfer",
            )
            logger.info(
                "SM100+ detected with mamba-ssm-dtype=bfloat16, "
                "defaulting --linear-attn-decode-backend to flashinfer."
            )

        # SM100+ FlashInfer GDN decode requires bf16 state; SM90 uses float32.
        decode = cfg.linear_attn_decode_backend or cfg.linear_attn_backend

        # FlashKDA is a prefill-only KDA kernel (no decode kernel) but shares the
        # backend choice list, so guard it from being selected for decode: error
        # on an explicit --linear-attn-decode-backend flashkda, and fall back to
        # triton decode when it was only inherited from base=flashkda (prefill
        # keeps FlashKDA).
        if decode == "flashkda":
            if cfg.linear_attn_decode_backend == "flashkda":
                raise ValueError(
                    "--linear-attn-decode-backend flashkda is not supported: "
                    "FlashKDA is prefill-only. Use "
                    "--linear-attn-prefill-backend flashkda (decode stays on triton)."
                )
            self._declare(
                "_handle_linear_attn_backend",
                linear_attn_decode_backend="triton",
            )
            decode = "triton"
            logger.info(
                "FlashKDA is prefill-only; using triton for KDA decode "
                "(FlashKDA stays on prefill)."
            )

        if (
            decode == "flashinfer"
            and cfg.mamba_ssm_dtype != "bfloat16"
            and is_cuda()

View on GitHub (pinned to 0132848349)

Solutions

  1. Set --linear-attn-prefill-backend flashkda and remove the decode flag (decode defaults to triton)
  2. Use a decode-capable backend such as triton for --linear-attn-decode-backend

Example fix

# before
--linear-attn-prefill-backend flashkda --linear-attn-decode-backend flashkda
# after
--linear-attn-prefill-backend flashkda
Defensive patterns

Strategy: validation

Validate before calling

if args.linear_attn_decode_backend == "flashkda":
    raise SystemExit("flashkda is prefill-only; set --linear-attn-prefill-backend instead")

Type guard

null

Prevention

When it happens

Trigger: Passing --linear-attn-decode-backend flashkda explicitly. Note the guard distinguishes explicit selection (raises) from a value merely inherited from base=flashkda, which silently falls back to triton decode.

Common situations: Users setting all three linear-attn backend flags (base/prefill/decode) to the same value; copy-pasting a prefill backend name into the decode flag; scripts that enumerate backends across both slots.

Related errors


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