{"record":{"id":"db530576bd222c91","repo":"rohitg00/ai-engineering-from-scratch","slug":"section-sec-id-r-references-unknown-figure-id-f","errorCode":null,"errorMessage":"section {sec.id!r} references unknown figure id {fid!r}","messagePattern":"section (.+?) references unknown figure id (.+?)","errorType":"validation","errorClass":"PaperValidationError","httpStatus":null,"severity":"error","filePath":"phases/19-capstone-projects/54-paper-writer/code/main.py","lineNumber":101,"sourceCode":"    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\"\\{\",\n        \"}\": r\"\\}\",\n        \"~\": r\"\\textasciitilde{}\",\n        \"^\": r\"\\textasciicircum{}\",\n    }\n    out_chars: list[str] = []","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/19-capstone-projects/54-paper-writer/code/main.py#L83-L119","documentation":"Error \"section {sec.id!r} references unknown figure id {fid!r}\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/19-capstone-projects/54-paper-writer/code/main.py:101 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"}