sgl-project/sglang · error · NotImplementedError
{self.__class__.__name__} does not support target_verify
Error message
{self.__class__.__name__} does not support target_verify What it means
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.
Source
Thrown at python/sglang/srt/layers/attention/linear/kernels/kernel_backend.py:63
**kwargs,
) -> tuple: ...
def target_verify(
self,
A_log: torch.Tensor,
dt_bias: torch.Tensor,
q: torch.Tensor,
k: torch.Tensor,
v: torch.Tensor,
a: torch.Tensor,
b: torch.Tensor,
*,
ssm_states: torch.Tensor,
cache_indices: torch.Tensor,
query_start_loc: torch.Tensor,
**kwargs,
) -> torch.Tensor:
raise NotImplementedError(
f"{self.__class__.__name__} does not support target_verify"
)
View on GitHub (pinned to 0132848349)
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
Example fix
# before
class MyKDAKernel(LinearAttentionBaseKernel): ... # no target_verify
# after
class MyKDAKernel(LinearAttentionBaseKernel):
def target_verify(self, *a, **k):
raise NotImplementedError(f"{self.__class__.__name__} does not support target_verify") # explicit, or implement it Defensive patterns
Strategy: type-guard
Validate before calling
import inspect
def has_target_verify(kernel_cls) -> bool:
base = LinearAttentionBaseKernel # adjust to actual base class name
return 'target_verify' in kernel_cls.__dict__ or not kernel_cls.target_verify.__objclass__ is base Type guard
def supports_target_verify(kernel) -> bool:
return type(kernel).__dict__.get('target_verify') is not None and type(kernel).__dict__['target_verify'].__code__ is not getattr(LinearAttentionBaseKernel, 'target_verify').__code__ Try / catch
try:
out = kernel.target_verify(...)
except NotImplementedError:
kernel = fallback_verify_kernel # e.g. flashinfer
out = kernel.target_verify(...) Prevention
- Implement or explicitly gate target_verify in custom kernels
- Check backend capability flags before enabling spec decoding
When it happens
Trigger: 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).
Common situations: Enabling speculative decoding with a linear-attention backend that has no verify kernel; adding a new custom kernel without implementing target_verify.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- CuteDSLKDAKernel does not support target_verify
- NvidiaKDAKernel does not support target_verify
- PtxKDAKernel does not support target_verify
- Lightning (seg_la) linear-attention backend does not support
- trtllm_mla does not forward the cyclic DCP metadata to its d
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/cdcb6156a33b12e2.
Report an issue: GitHub.