{"record":{"id":"fa6eedb1a4719698","repo":"sgl-project/sglang","slug":"prefill-only-disable-kv-cache-is-incompatible-wi","errorCode":null,"errorMessage":"--prefill-only-disable-kv-cache is incompatible with --attn-cp-size > 1: the context-parallel attention path writes K/V to the pool via set_kv_buffer, which the no-op pool intentionally rejects.","messagePattern":"--prefill-only-disable-kv-cache is incompatible with --attn-cp-size > 1: the context-parallel attention path writes K/V to the pool via set_kv_buffer, which the no-op pool intentionally rejects\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":8196,"sourceCode":"        # - disable_radix_cache stops the prefix cache from indexing pool\n        #   slots that no longer hold real data.\n        if cfg.chunked_prefill_size != -1:\n            raise ValueError(\n                \"--prefill-only-disable-kv-cache requires --chunked-prefill-size=-1 so the FA \"\n                \"backend takes the fa_skip_kv_cache path; otherwise the pool would be touched \"\n                \"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            )","sourceCodeStart":8178,"sourceCodeEnd":8214,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L8178-L8214","documentation":"Context-parallel prefill stages K/V through cp_allgather_and_save_kv_cache, which writes to the pool via set_kv_buffer. The NoOpMHATokenToKVPool intentionally raises on writes, so the engine would boot but fail on the first request; the validator rejects --attn-cp-size > 1 up front.","triggerScenarios":"Launching with --prefill-only-disable-kv-cache and --attn-cp-size set to a value greater than 1.","commonSituations":"A long-context embedding workload (e.g. large-document embeddings) where the user enables attention context parallelism for memory, then also disables the KV cache.","solutions":["Remove or set --attn-cp-size 1 when using --prefill-only-disable-kv-cache","Use tensor parallelism (--tp-size) instead of context parallelism for multi-GPU embedding serving","If CP is essential, drop --prefill-only-disable-kv-cache and keep the real pool"],"exampleFix":"# before\n--prefill-only-disable-kv-cache --attn-cp-size 2\n# after\n--prefill-only-disable-kv-cache --attn-cp-size 1 --tp-size 2","handlingStrategy":"validation","validationCode":"if want_disable_kv_cache and attn_cp_size > 1:\n    raise SystemExit(\"use --tp-size instead of --attn-cp-size with --prefill-only-disable-kv-cache\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not combine context parallelism with pool-free serving","Prefer TP for multi-GPU embedding servers"],"tags":["sglang","context-parallelism","kv-cache","distributed","server-args"],"backgroundTag":"unsupported-config-combination","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}