{"record":{"id":"17bcd7712525bbcc","repo":"sgl-project/sglang","slug":"invalid-attention-backend-backend-available-o","errorCode":null,"errorMessage":"Invalid attention backend '{backend}'. Available options are: {[e.name.lower() for e in AttentionBackendEnum]}","messagePattern":"Invalid attention backend '(.+?)'\\. Available options are: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/server_args/server_args.py","lineNumber":1023,"sourceCode":"                logger.info(\n                    \"Automatically set attention_backend=fa for LTX-2.3 one-stage on 1 GPU to preserve precision\"\n                )\n                return\n            self._set_default_attention_backend()\n\n    @staticmethod\n    def _normalize_attention_backend_name(backend: str) -> str:\n        if not isinstance(backend, str):\n            raise ValueError(\"Attention backend name must be a string\")\n        normalized = backend.strip().lower()\n        if normalized in (\"fa3\", \"fa4\"):\n            normalized = \"fa\"\n        elif normalized == \"cudnn_sdpa\":\n            normalized = \"torch_cudnn_sdpa\"\n        try:\n            return AttentionBackendEnum[normalized.upper()].name.lower()\n        except KeyError:\n            raise ValueError(\n                f\"Invalid attention backend '{backend}'. \"\n                f\"Available options are: {[e.name.lower() for e in AttentionBackendEnum]}\"\n            ) from None\n\n    @staticmethod\n    def _parse_component_value_map(\n        value: dict[str, Any] | str | None, *, option: str\n    ) -> dict[str, str]:\n        \"\"\"Parse a ``component=value`` map, the same shape as component backends.\"\"\"\n        if value is None or value == \"\":\n            return {}\n        if isinstance(value, dict):\n            return {str(k): str(v) for k, v in value.items()}\n        if not isinstance(value, str):\n            raise ValueError(\n                f\"{option} must be a dict or a comma-separated component=value string\"\n            )\n        try:","sourceCodeStart":1005,"sourceCodeEnd":1041,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/server_args/server_args.py#L1005-L1041","documentation":"After normalization (strip/lower, fa3|fa4->fa, cudnn_sdpa->torch_cudnn_sdpa), the backend name is looked up as AttentionBackendEnum[name.upper()]; an unknown name raises with the full list of valid enum members.","triggerScenarios":"Passing 'vit', 'trt', or any name not in AttentionBackendEnum as a global or per-component attention backend; using a backend name that only exists in a different framework (e.g. vLLM naming) or was renamed between versions.","commonSituations":"Version upgrades where a backend was renamed/removed; copy-pasting backend names from docs of a different library; typos not covered by the alias mapping.","solutions":["Pick a name from the list printed in the error (e.g. [e.name.lower() for e in AttentionBackendEnum])","Note the aliases: fa3/fa4 map to 'fa', cudnn_sdpa maps to 'torch_cudnn_sdpa'; use those canonical forms","Check AttentionBackendEnum in the codebase for your installed version"],"exampleFix":"# before\nServerArgs(..., attention_backend=\"flash_att\")\n# after\nServerArgs(..., attention_backend=\"fa\")","handlingStrategy":"validation","validationCode":"names = {e.name.lower() for e in AttentionBackendEnum}\naliases = {'fa3': 'fa', 'fa4': 'fa', 'cudnn_sdpa': 'torch_cudnn_sdpa'}\nnorm = aliases.get(name.strip().lower(), name.strip().lower())\nassert norm in names, f'unknown attention backend {name!r}'","typeGuard":"def is_valid_attention_backend(name: str) -> bool:\n    n = name.strip().lower()\n    n = {'fa3': 'fa', 'fa4': 'fa', 'cudnn_sdpa': 'torch_cudnn_sdpa'}.get(n, n)\n    return n in {e.name.lower() for e in AttentionBackendEnum}","tryCatchPattern":null,"preventionTips":["Use canonical names ('fa', 'torch_cudnn_sdpa') in configs","Derive the valid set from AttentionBackendEnum of the installed version"],"tags":["attention-backend","enum-validation","config"],"backgroundTag":"invalid-enum-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}