{"record":{"id":"8d6e2288a0cb027c","repo":"rohitg00/ai-engineering-from-scratch","slug":"section-sec-id-r-cites-unknown-bibliography-key","errorCode":null,"errorMessage":"section {sec.id!r} cites unknown bibliography key {key!r}","messagePattern":"section (.+?) cites unknown bibliography key (.+?)","errorType":"validation","errorClass":"PaperValidationError","httpStatus":null,"severity":"error","filePath":"phases/19-capstone-projects/54-paper-writer/code/main.py","lineNumber":96,"sourceCode":"        raise PaperValidationError(\"title is empty\")\n    if not paper.abstract.strip():\n        raise PaperValidationError(\"abstract is empty\")\n\n    fig_ids: set[str] = set()\n    for fig in paper.figures:\n        if fig.id in fig_ids:\n            raise PaperValidationError(f\"duplicate figure id: {fig.id}\")\n        fig_ids.add(fig.id)\n\n    bib_keys: set[str] = set()\n    for b in paper.bibliography:\n        if b.key in bib_keys:\n            raise PaperValidationError(f\"duplicate bibliography key: {b.key}\")\n        bib_keys.add(b.key)\n    for sec in paper.sections:\n        for key in sec.cites:\n            if key not in bib_keys:\n                raise PaperValidationError(\n                    f\"section {sec.id!r} cites unknown bibliography key {key!r}\"\n                )\n        for fid in sec.figure_refs:\n            if fid not in fig_ids:\n                raise PaperValidationError(\n                    f\"section {sec.id!r} references unknown figure id {fid!r}\"\n                )\n\n\ndef _escape_latex(text: str) -> str:\n    repl = {\n        \"\\\\\": r\"\\textbackslash{}\",\n        \"&\": r\"\\&\",\n        \"%\": r\"\\%\",\n        \"$\": r\"\\$\",\n        \"#\": r\"\\#\",\n        \"_\": r\"\\_\",\n        \"{\": r\"\\{\",","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/19-capstone-projects/54-paper-writer/code/main.py#L78-L114","documentation":"Error \"section {sec.id!r} cites unknown bibliography key {key!r}\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/19-capstone-projects/54-paper-writer/code/main.py:96 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":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}