{"record":{"id":"1dbb4247b639c5f1","repo":"HKUDS/DeepTutor","slug":"invalid-state-transition-capture-status-req","errorCode":null,"errorMessage":"Invalid state transition: {capture.status} -> {requested_status}","messagePattern":"Invalid state transition: (.+?) -> (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"deeptutor/api/routers/book.py","lineNumber":420,"sourceCode":"\n\n@router.patch(\"/books/{book_id}/learning-captures/{capture_id}\")\nasync def update_learning_capture(\n    book_id: str,\n    capture_id: str,\n    req: LearningCaptureUpdateRequest,\n) -> dict[str, Any]:\n    storage = get_book_storage()\n    capture = storage.load_learning_capture(book_id, capture_id)\n    if capture is None:\n        raise HTTPException(status_code=404, detail=\"Learning capture not found\")\n\n    requested_status = _coerce_capture_status(req.status) if req.status is not None else None\n    if requested_status is not None and not _is_capture_transition_allowed(\n        capture.status,\n        requested_status,\n    ):\n        raise HTTPException(\n            status_code=400,\n            detail=(f\"Invalid state transition: {capture.status} -> {requested_status}\"),\n        )\n\n    changed = False\n    updated = capture.model_copy(deep=True)\n\n    if requested_status is not None and requested_status != capture.status:\n        updated.status = requested_status\n        changed = True\n    if req.user_note is not None and req.user_note != capture.user_note:\n        updated.user_note = req.user_note\n        changed = True\n    if req.rejected_reason is not None and req.rejected_reason != capture.rejected_reason:\n        updated.rejected_reason = req.rejected_reason\n        changed = True\n\n    if not changed:","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/book.py#L402-L438","documentation":"Error \"Invalid state transition: {capture.status} -> {requested_status}\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/book.py:420 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}