{"record":{"id":"b28acf4528c1b85c","repo":"HKUDS/DeepTutor","slug":"spine-not-found","errorCode":null,"errorMessage":"Spine not found","messagePattern":"Spine not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"deeptutor/api/routers/book.py","lineNumber":497,"sourceCode":"\n    # A compiled book is hundreds of KB across one file per page.\n    spine, pages, progress = await asyncio.to_thread(_read)\n    return {\n        \"book\": book.model_dump(mode=\"json\"),\n        \"spine\": spine.model_dump(mode=\"json\") if spine else None,\n        \"pages\": [\n            (p.model_dump(mode=\"json\") if include_blocks else _page_summary(p)) for p in pages\n        ],\n        \"progress\": progress.model_dump(mode=\"json\"),\n    }\n\n\n@router.get(\"/books/{book_id}/spine\")\nasync def get_spine(book_id: str) -> dict[str, Any]:\n    engine = get_book_engine()\n    spine = engine.load_spine(book_id)\n    if spine is None:\n        raise HTTPException(status_code=404, detail=\"Spine not found\")\n    return {\"spine\": spine.model_dump(mode=\"json\")}\n\n\n@router.get(\"/books/{book_id}/pages/{page_id}\")\nasync def get_page(book_id: str, page_id: str) -> dict[str, Any]:\n    engine = get_book_engine()\n    page = engine.load_page(book_id, page_id)\n    if page is None:\n        raise HTTPException(status_code=404, detail=\"Page not found\")\n    return {\"page\": page.model_dump(mode=\"json\")}\n\n\n@router.delete(\"/books/{book_id}\")\nasync def delete_book(book_id: str) -> dict[str, Any]:\n    engine = get_book_engine()\n    ok = engine.delete_book(book_id)\n    if not ok:\n        raise HTTPException(status_code=404, detail=\"Book not found\")","sourceCodeStart":479,"sourceCodeEnd":515,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/book.py#L479-L515","documentation":"HTTP 404 raised by GET /books/{book_id}/spine in deeptutor/api/routers/book.py:497 when engine.load_spine(book_id) returns None — the book exists but has no compiled spine yet, meaning it has not finished (or undergone) the compilation stage that produces the structured table of contents.","triggerScenarios":"Thrown at deeptutor/api/routers/book.py:497 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the book compile step before requesting the spine","Handle a null spine in the client by offering to compile","Verify the book_id and its compilation state"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","contentChangedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}