{"record":{"id":"d2fa9327347451fd","repo":"sgl-project/sglang","slug":"prefill-only-disable-kv-cache-is-incompatible-wi-d2fa93","errorCode":null,"errorMessage":"--prefill-only-disable-kv-cache is incompatible with --enable-prefill-cp: the prefill-CP path stages K/V through the paged cache, which the no-op pool does not support.","messagePattern":"--prefill-only-disable-kv-cache is incompatible with --enable-prefill-cp: the prefill-CP path stages K/V through the paged cache, which the no-op pool does not support\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":8202,"sourceCode":"                \"between prefill chunks.\"\n            )\n        if not cfg.disable_radix_cache:\n            raise ValueError(\n                \"--prefill-only-disable-kv-cache requires --disable-radix-cache because the \"\n                \"radix cache indexes KV pool slots that no longer hold real data.\"\n            )\n\n        # Context-parallel prefill stages K/V through cp_allgather_and_save_kv_cache,\n        # which writes to the pool via set_kv_buffer. NoOpMHATokenToKVPool intentionally\n        # raises on writes, so the engine would boot fine but fail on the first request.\n        if self._resolved().attn_cp_size > 1:\n            raise ValueError(\n                \"--prefill-only-disable-kv-cache is incompatible with --attn-cp-size > 1: \"\n                \"the context-parallel attention path writes K/V to the pool via set_kv_buffer, \"\n                \"which the no-op pool intentionally rejects.\"\n            )\n        if cfg.enable_prefill_cp:\n            raise ValueError(\n                \"--prefill-only-disable-kv-cache is incompatible with \"\n                \"--enable-prefill-cp: the prefill-CP path stages K/V through \"\n                \"the paged cache, which the no-op pool does not support.\"\n            )\n\n        # HiSparse selects a different pool class (HiSparseDSATokenToKVPool /\n        # HiSparseTokenToKVPoolAllocator) that is not the no-op pool.\n        if cfg.enable_hisparse:\n            raise ValueError(\n                \"--prefill-only-disable-kv-cache is incompatible with --enable-hisparse: \"\n                \"HiSparse uses a dedicated pool family that is not the no-op MHA pool.\"\n            )\n\n    def _handle_prefill_only_disable_kv_cache(self):\n        \"\"\"Validate --prefill-only-disable-kv-cache backend constraint.\n\n        Must run after _handle_attention_backend_compatibility() (which fills\n        the default attention_backend if unset) and _handle_multi_item_scoring()","sourceCodeStart":8184,"sourceCodeEnd":8220,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L8184-L8220","documentation":"The prefill context-parallel path (--enable-prefill-cp) stages K/V through the paged cache, which the no-op KV pool used by --prefill-only-disable-kv-cache does not support. The validator rejects the combination at startup rather than failing mid-request.","triggerScenarios":"Launching with --prefill-only-disable-kv-cache together with --enable-prefill-cp (cfg.enable_prefill_cp true).","commonSituations":"A user enables prefill CP to split long prefills across GPUs for an embedding/reranking workload, then adds KV-cache disabling to save memory.","solutions":["Remove --enable-prefill-cp when using --prefill-only-disable-kv-cache","Scale with tensor/data parallelism instead of prefill CP","If prefill CP is required, drop --prefill-only-disable-kv-cache"],"exampleFix":"# before\n--prefill-only-disable-kv-cache --enable-prefill-cp\n# after\n--prefill-only-disable-kv-cache --tp-size 2","handlingStrategy":"validation","validationCode":"if want_disable_kv_cache and enable_prefill_cp:\n    raise SystemExit(\"--enable-prefill-cp is incompatible with --prefill-only-disable-kv-cache\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Audit long-context flags (CP, prefill-CP) before enabling the no-op pool","Keep multi-GPU scaling via TP/DP for embedding workloads"],"tags":["sglang","context-parallelism","prefill","kv-cache","server-args"],"backgroundTag":"unsupported-config-combination","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}