HKUDS/DeepTutor · error · ValueError

Page {page_id} references unknown chapter {page.chapter_id}

Error message

Page {page_id} references unknown chapter {page.chapter_id}

What it means

Error "Page {page_id} references unknown chapter {page.chapter_id}" thrown in HKUDS/DeepTutor.

Source

Thrown at deeptutor/book/engine.py:1106

        # their hand-built blocks — that would overwrite the deterministic
        # "How to read this book" intro and chapter index with hallucinated
        # prose. Reaching here means force=True or the page is not yet READY, so
        # rebuild deterministically (this also refreshes a changed spine).
        if page.content_type == ContentType.OVERVIEW:
            page.status = PageStatus.PENDING
            self.storage.save_page(page)
            await self._materialize_overview_page(spine, [page], book, stream=stream)
            page = self.storage.load_page(book_id, page_id) or page
            await self._maybe_finalize_book(book_id)
            return page

        if force:
            self._reset_page_for_force_compile(page)
            self.storage.save_page(page)

        chapter = spine.chapter_by_id(page.chapter_id)
        if chapter is None:
            raise ValueError(f"Page {page_id} references unknown chapter {page.chapter_id}")

        bus = stream or get_book_bus(book_id)
        bstream = BookStream(bus)

        try:
            async with bstream.stage(STAGE_COMPILATION):
                page = await self.compiler.compile_page(
                    book_id=book_id,
                    chapter=chapter,
                    page=page,
                    stream=bstream,
                    knowledge_bases=book.knowledge_bases,
                    language=book.language,
                    depth=book.depth.value,
                )
        except Exception as exc:
            self._mark_page_error(page, exc, prefix="Compilation failed")
            raise

View on GitHub (pinned to 3e82f13042)

When it happens

Trigger: Thrown at deeptutor/book/engine.py:1106 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/edf33e32517f7f88. Report an issue: GitHub.