{"record":{"id":"c6e07b306409f71c","repo":"rohitg00/ai-engineering-from-scratch","slug":"duplicate-bibliography-key-b-key","errorCode":null,"errorMessage":"duplicate bibliography key: {b.key}","messagePattern":"duplicate bibliography key: (.+?)","errorType":"exception","errorClass":"PaperValidationError","httpStatus":null,"severity":"error","filePath":"phases/19-capstone-projects/54-paper-writer/code/main.py","lineNumber":91,"sourceCode":"ProseGenerator = Callable[[Section, Paper], str]\n\n\ndef _validate(paper: Paper) -> None:\n    if not paper.title.strip():\n        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\"\\&\",","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/19-capstone-projects/54-paper-writer/code/main.py#L73-L109","documentation":"Error \"duplicate bibliography key: {b.key}\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/19-capstone-projects/54-paper-writer/code/main.py:91 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"}