{"record":{"id":"cdcb6156a33b12e2","repo":"sgl-project/sglang","slug":"self-class-name-does-not-support-target","errorCode":null,"errorMessage":"{self.__class__.__name__} does not support target_verify","messagePattern":"(.+?) does not support target_verify","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/layers/attention/linear/kernels/kernel_backend.py","lineNumber":63,"sourceCode":"        **kwargs,\n    ) -> tuple: ...\n\n    def target_verify(\n        self,\n        A_log: torch.Tensor,\n        dt_bias: torch.Tensor,\n        q: torch.Tensor,\n        k: torch.Tensor,\n        v: torch.Tensor,\n        a: torch.Tensor,\n        b: torch.Tensor,\n        *,\n        ssm_states: torch.Tensor,\n        cache_indices: torch.Tensor,\n        query_start_loc: torch.Tensor,\n        **kwargs,\n    ) -> torch.Tensor:\n        raise NotImplementedError(\n            f\"{self.__class__.__name__} does not support target_verify\"\n        )\n","sourceCodeStart":45,"sourceCodeEnd":66,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/attention/linear/kernels/kernel_backend.py#L45-L66","documentation":"This is the base LinearAttentionBackend default target_verify: any kernel subclass that does not override it will raise NotImplementedError naming the class. It marks spec-decode verify as unsupported for that backend.","triggerScenarios":"Calling target_verify on any KDA/linear-attention kernel class that never implemented it (cutedsl and nvidia inherit-raise explicitly; others fall through to this base).","commonSituations":"Enabling speculative decoding with a linear-attention backend that has no verify kernel; adding a new custom kernel without implementing target_verify.","solutions":["Switch to a backend implementing target_verify (flashinfer) when spec decoding is on","Disable speculative decoding","If writing a custom kernel, implement target_verify or explicitly raise early at init"],"exampleFix":"# before\nclass MyKDAKernel(LinearAttentionBaseKernel): ...  # no target_verify\n# after\nclass MyKDAKernel(LinearAttentionBaseKernel):\n    def target_verify(self, *a, **k):\n        raise NotImplementedError(f\"{self.__class__.__name__} does not support target_verify\")  # explicit, or implement it","handlingStrategy":"type-guard","validationCode":"import inspect\ndef has_target_verify(kernel_cls) -> bool:\n    base = LinearAttentionBaseKernel  # adjust to actual base class name\n    return 'target_verify' in kernel_cls.__dict__ or not kernel_cls.target_verify.__objclass__ is base","typeGuard":"def supports_target_verify(kernel) -> bool:\n    return type(kernel).__dict__.get('target_verify') is not None and type(kernel).__dict__['target_verify'].__code__ is not getattr(LinearAttentionBaseKernel, 'target_verify').__code__","tryCatchPattern":"try:\n    out = kernel.target_verify(...)\nexcept NotImplementedError:\n    kernel = fallback_verify_kernel  # e.g. flashinfer\n    out = kernel.target_verify(...)","preventionTips":["Implement or explicitly gate target_verify in custom kernels","Check backend capability flags before enabling spec decoding"],"tags":["sglang","linear-attention","speculative-decoding","not-implemented","base-class"],"backgroundTag":"unsupported-operation","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}