{"record":{"id":"98a24ea89c756190","repo":"jax-ml/jax","slug":"sliding-window-must-be-positive","errorCode":null,"errorMessage":"{sliding_window=} must be positive.","messagePattern":"(.+?) must be positive\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"jax/experimental/pallas/ops/tpu/ragged_paged_attention/kernel.py","lineNumber":272,"sourceCode":"  if cu_q_lens.shape != (max_num_seqs + 1,):\n    raise ValueError(\n        f\"Expected {cu_q_lens.shape=} to be ({max_num_seqs + 1},)  where\"\n        \" `max_num_seqs` is `page_indices.shape[0]`.\"\n    )\n  if (\n      kv_lens.dtype != jnp.int32\n      or page_indices.dtype != jnp.int32\n      or cu_q_lens.dtype != jnp.int32\n  ):\n    raise ValueError(\n        \"The dtype of `kv_lens`, `page_indices`, and `cu_q_lens` must be\"\n        f\" int32. Got {kv_lens.dtype=}, {page_indices.dtype=},\"\n        f\" {cu_q_lens.dtype=}.\"\n    )\n  if num_q_heads % num_kv_heads != 0:\n    raise ValueError(f\"{num_q_heads=} must be divisible by {num_kv_heads=}\")\n  if sliding_window is not None and sliding_window <= 0:\n    raise ValueError(f\"{sliding_window=} must be positive.\")\n  if soft_cap is not None and soft_cap == 0.0:\n    raise ValueError(f\"{soft_cap=} must not be 0.0.\")\n  if (\n      num_kv_pages_per_block is not None\n      and not 0 < num_kv_pages_per_block <= pages_per_seq\n  ):\n    raise ValueError(\n        f\"{num_kv_pages_per_block=} must be in range (0, {pages_per_seq}].\"\n    )\n  if num_queries_per_block is not None and num_queries_per_block <= 0:\n    raise ValueError(f\"{num_queries_per_block=} must be positive.\")\n  if vmem_limit_bytes is not None and vmem_limit_bytes <= 0:\n    raise ValueError(f\"{vmem_limit_bytes=} must be positive.\")\n  del sm_scale  # No constraints on sm_scale.\n  del mask_value  # No consstraints on mask_value.\n\n\ndef ragged_paged_attention_kernel(","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/experimental/pallas/ops/tpu/ragged_paged_attention/kernel.py#L254-L290","documentation":"When a sliding window is supplied to ragged_paged_attention it must be a positive integer (window size in tokens). A zero or negative window is meaningless and is rejected by static_validate_inputs before kernel launch.","triggerScenarios":"Passing sliding_window=0 (often intended to mean 'disabled'), a negative value, or a config default like -1 that means 'no window' elsewhere.","commonSituations":"Porting configs from HuggingFace / vLLM style code where sliding_window=None and sliding_window=0 both conventionally mean no window; here 0 is an error rather than a no-op.","solutions":["Pass sliding_window=None to disable windowing instead of 0","Otherwise pass the actual positive window size (e.g. 4096)","Sanitize config values: sliding_window = cfg.window or None"],"exampleFix":"// before\nattn(..., sliding_window=0)  # intended 'no window'\n// after\nattn(..., sliding_window=None)","handlingStrategy":"validation","validationCode":"sliding_window = sliding_window if (sliding_window is None or sliding_window > 0) else None","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat 0/negative as 'disabled' and convert to None at config-load time","Never forward raw model-config sentinel values to the kernel"],"tags":["jax","pallas","tpu","sliding-window","config-validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}