{"record":{"id":"853ce04f10278a9c","repo":"HKUDS/DeepTutor","slug":"source-text-is-required","errorCode":null,"errorMessage":"source_text is required","messagePattern":"source_text is required","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"deeptutor/api/routers/book.py","lineNumber":362,"sourceCode":"    return {\"captures\": [_capture_payload(capture) for capture in captures]}\n\n\n@router.post(\"/books/{book_id}/learning-captures\")\nasync def create_learning_capture(\n    book_id: str,\n    req: LearningCaptureCreateRequest,\n) -> dict[str, Any]:\n    engine = get_book_engine()\n    if engine.load_book(book_id) is None:\n        raise HTTPException(status_code=404, detail=\"Book not found\")\n\n    page = engine.load_page(book_id, req.page_id)\n    if page is None:\n        raise HTTPException(status_code=404, detail=\"Page not found\")\n\n    source_text = _normalize_capture_text(req.source_text)\n    if not source_text:\n        raise HTTPException(status_code=400, detail=\"source_text is required\")\n\n    book_title, chapter_title, default_source_locator = _derive_capture_title_values(\n        book_id=book_id,\n        page_id=req.page_id,\n        block_id=req.block_id,\n    )\n\n    source_locator = req.source_locator.strip() or default_source_locator\n    status = _coerce_capture_status(req.status) or LearningCaptureStatus.CAPTURED\n\n    content_hash = _build_capture_hash(\n        book_id,\n        req.page_id,\n        req.block_id,\n        source_locator,\n        source_text,\n    )\n","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/book.py#L344-L380","documentation":"Error \"source_text is required\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/book.py:362 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"}