{"record":{"id":"a885439511a48abc","repo":"sgl-project/sglang","slug":"unknown-request-id-request-id","errorCode":null,"errorMessage":"Unknown request_id: {request_id}","messagePattern":"Unknown request_id: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/disaggregation/request_state.py","lineNumber":104,"sourceCode":"                raise ValueError(f\"Duplicate request_id: {request_id}\")\n            record = RequestRecord(request_id=request_id)\n            self._requests[request_id] = record\n            return record\n\n    def transition(\n        self,\n        request_id: str,\n        new_state: RequestState,\n        *,\n        error: str | None = None,\n        encoder_instance: int | None = None,\n        denoiser_instance: int | None = None,\n        decoder_instance: int | None = None,\n    ) -> RequestRecord:\n        with self._lock:\n            record = self._requests.get(request_id)\n            if record is None:\n                raise ValueError(f\"Unknown request_id: {request_id}\")\n\n            old_state = record.state\n\n            if new_state in _TERMINAL_STATES and new_state != RequestState.DONE:\n                # FAILED / TIMED_OUT: allowed from any active state\n                if old_state not in _ACTIVE_STATES:\n                    raise ValueError(\n                        f\"Cannot transition {request_id} from terminal state \"\n                        f\"{old_state.value} to {new_state.value}\"\n                    )\n            elif new_state not in _VALID_TRANSITIONS.get(old_state, set()):\n                raise ValueError(\n                    f\"Invalid transition for {request_id}: \"\n                    f\"{old_state.value} -> {new_state.value}\"\n                )\n\n            record.state = new_state\n            record.last_transition_time = time.monotonic()","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/disaggregation/request_state.py#L86-L122","documentation":"Raised by RequestStateStore.transition when the given request_id has no record in the store. All state transitions (dispatch, transfer staged, completion, failure) operate on a previously submitted RequestRecord, so an unknown id indicates the request was never submitted, was already cleaned up, or the id is wrong.","triggerScenarios":"Calling transition(request_id, ...) from any handler (_handle_client_request, _handle_decoder_result_frames, _dispatch_to_encoder, _complete_with_error, _handle_transfer_staged, _transfer_dispatch_to_denoiser) for an id that was never submit()ted or was evicted after reaching a terminal state.","commonSituations":"Frames arriving after a request completed and was removed from the store (race between completion and late decoder frames), restarts that lose in-memory state while clients keep sending, id mismatches between encode/decode stages, or processing an error for an already-cleaned request.","solutions":["Guard handlers: look up the record (or catch this ValueError) and drop/log late frames for unknown ids instead of propagating","Ensure the request is submit()ted before any component can emit frames referencing its id","Delay or cancel in-flight work (encoder/decoder/transfer tasks) before removing terminal requests from the store","On restart, reset clients/queues so stale ids are not reused against an empty store"],"exampleFix":"# before\nstore.transition(request_id, RequestState.DECODING)  # ValueError if unknown\n\n# after\ntry:\n    store.transition(request_id, RequestState.DECODING)\nexcept ValueError:\n    logger.warning(\"dropping frame for unknown request %s\", request_id)\n    return","handlingStrategy":"try-catch","validationCode":"record = store.get(request_id) if hasattr(store, \"get\") else None\nif record is None:\n    # unknown/already-cleaned request; drop or re-submit\n    logger.warning(\"unknown request %s; ignoring frame\", request_id)\n    return","typeGuard":null,"tryCatchPattern":"try:\n    store.transition(request_id, new_state)\nexcept ValueError as e:\n    if \"Unknown request_id\" in str(e):\n        logger.debug(\"late frame for cleaned request %s\", request_id)\n        return  # idempotent drop\n    raise","preventionTips":["Submit() the request before subscribing any handler that can emit frames for it","Delay store cleanup of terminal requests until in-flight frames are drained or cancelled","Log request ids end-to-end so unknown-id frames can be traced to races or restarts"],"tags":["disaggregation","request-state","unknown-id","stale-request"],"backgroundTag":"unknown-request-id","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}