{"record":{"id":"1f87d784b9d153bb","repo":"vllm-project/vllm","slug":"request-req-id-is-not-in-unfinished-requests-b","errorCode":null,"errorMessage":"Request {req_id} is not in _unfinished_requests, but it is scheduled to be cached","messagePattern":"Request (.+?) is not in _unfinished_requests, but it is scheduled to be cached","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vllm/distributed/kv_transfer/kv_connector/v1/lmcache_integration/vllm_v1_adapter.py","lineNumber":1388,"sourceCode":"                    self._block_size,\n                    self._lmcache_chunk_size,\n                    load_spec=None,\n                    discard_partial_chunks=self._discard_partial_chunks,\n                )\n                if req_meta is not None:\n                    meta.add_request(req_meta)\n            return meta\n\n        for i, req_id in enumerate(cached_reqs.req_ids):\n            request_tracker = self._request_trackers[req_id]\n            num_new_tokens = scheduler_output.num_scheduled_tokens[req_id]\n            if cached_request := self._unfinished_requests.get(req_id):\n                num_current_tokens = len(request_tracker.token_ids)\n                new_token_ids = cached_request.all_token_ids[\n                    num_current_tokens : num_current_tokens + num_new_tokens\n                ]\n            else:\n                raise ValueError(\n                    f\"Request {req_id} is not in _unfinished_requests, \"\n                    f\"but it is scheduled to be cached\"\n                )\n            new_block_ids = cached_reqs.new_block_ids[i]\n\n            request_tracker.update(new_token_ids, new_block_ids)\n\n            req_meta = ReqMeta.from_request_tracker(\n                request_tracker,\n                self._block_size,\n                self._lmcache_chunk_size,\n                load_spec=None,\n                discard_partial_chunks=self._discard_partial_chunks,\n                save_decode_cache=self._save_decode_cache,\n            )\n            if req_meta is not None:\n                meta.add_request(req_meta)\n","sourceCodeStart":1370,"sourceCodeEnd":1406,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/distributed/kv_transfer/kv_connector/v1/lmcache_integration/vllm_v1_adapter.py#L1370-L1406","documentation":"ValueError raised while processing scheduler output in the LMCache v1 adapter: a request appears in cached_reqs.req_ids (scheduled for KV caching) but is absent from the adapter's _unfinished_requests map. The map is populated when requests finish and removed as they complete, so this means the adapter's view of live requests has diverged from the scheduler's — typically a finished/aborted request being scheduled again, or an engine-internal lifecycle bug. It aborts the update loop to prevent caching tokens for an unknown request.","triggerScenarios":"A request that was aborted or completed is still present in the scheduler's cached_reqs batch; request eviction in the adapter racing with a reschedule; version drift between the adapter's tracking logic and the scheduler's request lifecycle.","commonSituations":"Running an lmcache version not matched to the deployed vLLM scheduler behavior; crashes under heavy preemption/abort workloads; custom schedulers altering request finish ordering.","solutions":["Align lmcache and vllm versions to a tested compatible pair (check LMCache's compatibility matrix).","Check engine logs for aborted/preempted requests immediately preceding the error to identify the racing request.","Reproduce with preemptions/aborts disabled or reduced to see if request lifecycle churn is the trigger, and report with a minimal repro to LMCache/vLLM.","As a workaround for a stuck deployment, restart the engine; the inconsistency is in-memory only."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"Catch ValueError around the scheduler-output processing loop, log req_id plus the adapter's _unfinished_requests keys for the diff, and fail loudly — this indicates state divergence that should be reported, not papered over.","preventionTips":["Pin compatible vllm+lmcache versions","Stress-test abort/preemption paths when evaluating LMCache upgrades","Capture engine logs around request aborts when reporting the bug"],"tags":["lmcache","scheduler","state-inconsistency","kv-transfer"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}