{"record":{"id":"92ca4c74fa0a6205","repo":"sgl-project/sglang","slug":"aiter-backend-does-not-have-a-metadata-builder","errorCode":null,"errorMessage":"AITer backend does not have a metadata builder.","messagePattern":"AITer backend does not have a metadata builder\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/layers/attention/backends/aiter.py","lineNumber":112,"sourceCode":"    Backend for AITemplate attention implementation.\n    \"\"\"\n\n    @staticmethod\n    def get_enum() -> AttentionBackendEnum:\n        return AttentionBackendEnum.AITER\n\n    @staticmethod\n    def get_impl_cls() -> type[\"AITerImpl\"]:\n        return AITerImpl\n\n    @staticmethod\n    def get_metadata_cls() -> type[\"AttentionMetadata\"]:\n        # AITer backend does not require special metadata.\n        return AttentionMetadata\n\n    @staticmethod\n    def get_builder_cls() -> type[\"AttentionMetadataBuilder\"]:\n        raise NotImplementedError(\"AITer backend does not have a metadata builder.\")\n\n\nclass AITerImpl(AttentionImpl):\n    \"\"\"\n    Implementation of attention using AITemplate.\n    \"\"\"\n\n    def __init__(\n        self,\n        num_heads: int,\n        head_size: int,\n        softmax_scale: float,\n        causal: bool = False,\n        num_kv_heads: int | None = None,\n        prefix: str = \"\",\n        dropout_p: float = 0.0,\n        **extra_impl_args,\n    ) -> None:","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/layers/attention/backends/aiter.py#L94-L130","documentation":"The AITer attention backend's AttentionBackend static method get_builder_cls raises NotImplementedError by design: AITer does not use per-batch attention metadata builders, so requesting one is a programming error in the caller. Note get_metadata_cls returns plain AttentionMetadata.","triggerScenarios":"Calling AITerBackend.get_builder_cls() directly, or generic orchestration code that unconditionally instantiates a metadata builder for every registered backend instead of checking support first.","commonSituations":"Writing new runtime glue that assumes every backend implements get_builder_cls; refactoring the backend registry; a fallback/dispatch layer that probes all backends' builders at startup.","solutions":["Do not call get_builder_cls for AITer; guard with hasattr/try or a backend capability flag before requesting a builder","Use get_metadata_cls() (returns base AttentionMetadata) since AITer needs no special metadata","If your code path requires a builder, route AITer through a no-op builder like AscendFAMetadataBuilder's pattern or skip metadata building entirely"],"exampleFix":"# before\nbuilder = backend.get_builder_cls()()  # crashes for AITer\n# after\ntry:\n    builder = backend.get_builder_cls()()\nexcept NotImplementedError:\n    builder = None  # AITer needs no metadata builder","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    builder = backend.get_builder_cls()()\nexcept NotImplementedError:\n    builder = None  # AITer needs no metadata builder","preventionTips":["Treat NotImplementedError from get_builder_cls as 'backend capability: no builder' in dispatch tables","Unit-test dispatch code against all registered backends"],"tags":["aiter","attention-backend","rocm","not-implemented"],"backgroundTag":"unsupported-operation","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}