{"record":{"id":"ea323c19d32ccd0f","repo":"typst/typst","slug":"label-occurs-both-in-the-document-and-a-bibli","errorCode":null,"errorMessage":"label `{}` occurs both in the document and a bibliography","messagePattern":"label `(.+?)` occurs both in the document and a bibliography","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/typst-library/src/model/reference.rs","lineNumber":265,"sourceCode":"                ))\n                .at(span)?;\n            let supplement = engine.introspect(PageSupplementIntrospection(loc, span));\n\n            return realize_reference(\n                self,\n                engine,\n                styles,\n                Counter::new(CounterKey::Page),\n                numbering,\n                supplement,\n                elem,\n            );\n        }\n        // RefForm::Normal\n\n        if BibliographyElem::has(engine, self.target, span) {\n            if let Ok(elem) = elem {\n                bail!(\n                    span,\n                    \"label `{}` occurs both in the document and a bibliography\",\n                    self.target.repr();\n                    hint: \"change either the {}'s label or the \\\n                           bibliography key to resolve the ambiguity\",\n                    elem.func().name();\n                );\n            }\n\n            return Ok(to_citation(self, engine, styles)?.pack().spanned(span));\n        }\n\n        let elem = elem.at(span)?;\n\n        if let Some(footnote) = elem.to_packed::<FootnoteElem>() {\n            return Ok(footnote.into_ref(self.target).pack().spanned(span));\n        }\n","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/typst/typst/blob/35417aa769ab9d699a60384f91082b09bc6ba421/crates/typst-library/src/model/reference.rs#L247-L283","documentation":"Raised in reference realization: the referenced label exists both as an element in the document and as an entry in the bibliography, so Typst cannot decide which to resolve to.","triggerScenarios":"Thrown at crates/typst-library/src/model/reference.rs:265 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename one of the labels so they differ","Remove the bibliography entry or the in-document label"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35417aa769ab9d699a60384f91082b09bc6ba421","analyzedAt":"2026-08-17T21:03:48.984Z","contentChangedAt":"2026-08-17T21:03:48.984Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}