sgl-project/sglang · error · ValueError

Unsupported sol_attn dense_backend={dense_backend!r}; expect

Error message

Unsupported sol_attn dense_backend={dense_backend!r}; expected one of {sorted(_DENSE_BACKENDS)}

What it means

sol_attn reads its runtime config (including dense_backend, the fallback dense attention kernel) from a config dict, normalizing aliases like 'sage'/'sageattention' to 'sage_attn'. Any value not in _DENSE_BACKENDS raises ValueError listing allowed values.

Source

Thrown at python/sglang/multimodal_gen/runtime/layers/attention/backends/sol_attn.py:68

            import cuda.bindings.driver  # noqa: F401
            import cutlass.cute  # noqa: F401

            return 4
        except ImportError:
            pass
    return 1


def _get_sol_attn_runtime_config() -> dict:
    server_args = get_global_server_args()
    cfg = getattr(server_args, "attention_backend_config", None) or {}
    dense_backend = (
        str(cfg.get("dense_backend", "fa")).strip().lower().replace("-", "_")
    )
    if dense_backend in {"sage", "sageattention"}:
        dense_backend = "sage_attn"
    if dense_backend not in _DENSE_BACKENDS:
        raise ValueError(
            f"Unsupported sol_attn dense_backend={dense_backend!r}; "
            f"expected one of {sorted(_DENSE_BACKENDS)}"
        )
    sink_start = cfg.get("sink_start", 0)
    return {
        "tau": float(cfg.get("tau", 1.0)),
        "thresh_type": str(cfg.get("thresh_type", "diag")),
        "kv_splits": cfg.get("kv_splits", "auto"),
        "sink_tokens": int(cfg.get("sink_tokens", 0)),
        "sink_start": None if sink_start is None else int(sink_start),
        "dense_steps": int(cfg.get("dense_steps", 10)),
        "dense_layers": _parse_layer_ranges(cfg.get("dense_layers", "0,1")),
        "dense_backend": dense_backend,
    }


class SolAttnBackend(AttentionBackend):
    accept_output_buffer: bool = True

View on GitHub (pinned to 0132848349)

Solutions

  1. Set dense_backend to one of the names printed in the error (sorted(_DENSE_BACKENDS)), e.g. 'fa' or 'sage_attn'
  2. Remember only 'sage' and 'sageattention' are aliases; other spellings are not
  3. Restart after editing so the config is re-parsed

Example fix

# before
{"dense_backend": "flash"}
# after
{"dense_backend": "fa"}
Defensive patterns

Strategy: validation

Validate before calling

dense_backend = str(cfg.get("dense_backend", "fa")).strip().lower().replace("-", "_")
if dense_backend in {"sage", "sageattention"}:
    dense_backend = "sage_attn"
assert dense_backend in _DENSE_BACKENDS, f"bad dense_backend {dense_backend!r}"

Prevention

When it happens

Trigger: Setting sol_attn's dense_backend (via the diffusion attention config) to a typo'd or unsupported name such as 'flash', 'fa2', or 'torch'.

Common situations: Config typos; using backend names from a different SGLang version; copy-pasted configs from docs of another attention implementation.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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