sgl-project/sglang · error · ValueError
--linear-replayssm-cache-len must be >= 1, got {cfg.linear_r
Error message
--linear-replayssm-cache-len must be >= 1, got {cfg.linear_replayssm_cache_len}. What it means
Validates that --linear-replayssm-cache-len is at least 1. The cache length sizes the ReplaySSM ring window (e.g. KDA keeps a cache-len window and folds via its fused verify ring-write), so zero or negative values are meaningless and rejected.
Source
Thrown at python/sglang/srt/server_args.py:6962
if mamba_extra_buffer_of(resolved_view(self)):
raise ValueError(
"--enable-linear-replayssm requires --mamba-radix-cache-strategy "
"no_buffer (the default); the extra_buffer ping-pong "
"donation path is not yet supported (follow-up). Got "
f"--mamba-radix-cache-strategy={cfg.mamba_radix_cache_strategy!r}."
)
if cfg.disaggregation_mode != "null":
# The disaggregated decode pool (HybridMambaDecodeReqToTokenPool)
# is not wired for the ReplaySSM ring, so the flag would silently
# no-op there; disagg also runs a different cache/coordination
# flow that is not yet validated for ReplaySSM (follow-up).
raise ValueError(
"--enable-linear-replayssm is not supported under PD "
"disaggregation yet (follow-up). Got "
f"--disaggregation-mode={cfg.disaggregation_mode!r}."
)
if cfg.linear_replayssm_cache_len < 1:
raise ValueError(
"--linear-replayssm-cache-len must be >= 1, got "
f"{cfg.linear_replayssm_cache_len}."
)
# ReplaySSM spec-verify (Part B of #28511): linear-chain target verify via
# fold-every-commit -- the verify stores each draft step's raw inputs into
# the per-slot (rawv, rawk, g, beta) window and the commit replays the
# accepted prefix into the fp32 checkpoint. The intra-window interaction
# uses a strictly-lower causal mask, so it is valid ONLY for a linear
# draft chain (speculative_eagle_topk in {None, 1}, i.e. NEXTN / MTP);
# EAGLE tree verify (topk > 1) must fall back to the recurrent verify.
# GDN sizes the window to the draft maximum; KDA (kda_backend) keeps a
# --linear-replayssm-cache-len window and folds via its own fused
# verify ring-write + commit_kda_replayssm_after_verify.
if cfg.enable_linear_replayssm_spec:
if cfg.speculative_eagle_topk not in (None, 1):
raise ValueError(
"--enable-linear-replayssm-spec requires a linear draft chain "View on GitHub (pinned to 0132848349)
Solutions
- Set --linear-replayssm-cache-len to a positive integer (e.g. 128)
- If you intended the default, omit the flag entirely
- Check any script computing this value for off-by-one/empty-input bugs
Example fix
# before --enable-linear-replayssm --linear-replayssm-cache-len 0 # after --enable-linear-replayssm --linear-replayssm-cache-len 128
Defensive patterns
Strategy: validation
Validate before calling
def validate(cache_len, enable_replayssm):
return not enable_replayssm or (isinstance(cache_len, int) and cache_len >= 1) Type guard
def valid_cache_len(n) -> bool: return isinstance(n, int) and n >= 1
Prevention
- Sanitize scripted/computed arg values before launching
- Remember 0 does not mean 'default' for this flag
When it happens
Trigger: Passing --linear-replayssm-cache-len 0 (or a negative number) together with --enable-linear-replayssm; e.g. someone setting 0 intending 'unlimited/default'.
Common situations: Treating 0 as 'auto'/'disabled' (common convention elsewhere); scripting loops that compute cache length and can emit 0; typos in launch scripts.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- --speculative-draft-window-size must be positive, got {}.
- routed_dp_rank={routed_dp_rank} out of range [0, {dp_size})
- item_first is not supported when embeddings are supplied
- --dcp-replicate-q-proj requires --dcp-size > 1.
- --dcp-replicate-q-proj only applies to the a2a/fi_a2a DCP co
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/74a227be7c0cce26.
Report an issue: GitHub.