I couldn't open database file <name>.bib
BibTeX cannot find the .bib file named in \bibliography. Check the spelling and folder, and write the name without the .bib extension.
Help centre › LaTeX errors › References and bibliography · Error: the build stops or the output is wrong
What the log says
The top-level auxiliary file: main.aux
The style file: plain.bst
I couldn't open database file ref.bib
---line 4 of file main.aux
: \bibdata{ref
: }
I'm skipping whatever remains of this commandWhat it means
This is a BibTeX error, found in the .blg file rather than the .log. \bibliography{…} tells BibTeX which .bib files to read, and one of them does not exist under that name. BibTeX writes an empty or partial bibliography, so the citations from that file are undefined.
Causes and fixes
Most common first. Each example is a complete document; the first fails with this message, the second is the same document fixed.
1. The file name in \bibliography is misspelled
The name must match the .bib file exactly, including case on servers that distinguish it (Refs.bib is not refs.bib). Write it without the extension: \bibliography{refs} for refs.bib.
\begin{filecontents*}[overwrite]{refs.bib}
@article{smith2020,
author = {Smith, Jane and Brown, Paul},
title = {Measuring Things Carefully},
journal = {Journal of Measurement},
year = {2020},
volume = {12},
pages = {1--10}
}
\end{filecontents*}
\documentclass{article}
\begin{document}
As shown by \cite{smith2020}, the effect is small.
\bibliographystyle{plain}
\bibliography{ref}
\end{document}\begin{filecontents*}[overwrite]{refs.bib}
@article{smith2020,
author = {Smith, Jane and Brown, Paul},
title = {Measuring Things Carefully},
journal = {Journal of Measurement},
year = {2020},
volume = {12},
pages = {1--10}
}
\end{filecontents*}
\documentclass{article}
\begin{document}
As shown by \cite{smith2020}, the effect is small.
\bibliographystyle{plain}
\bibliography{refs}
\end{document}2. The .bib file is in a subfolder
BibTeX looks next to the .aux file. If the .bib lives in a folder, include the path relative to the main file, with forward slashes: \bibliography{bib/refs}. Avoid spaces in the folder and file names.
3. Several files are separated by spaces, or the file was never uploaded
Separate multiple files with commas and no spaces: \bibliography{refs,extra}. If the file is listed correctly, check that it is actually in the project.
In Manulyx
The editor reports this BibTeX error with the file name it could not open, and lists the undefined citations it causes under it rather than as separate problems.
Write in Manulyx for free · Journal templates
More in references and bibliography
- LaTeX Warning: Reference `<label>' on page <n> undefinedA \ref, \eqref or \pageref names a label LaTeX has not seen: a typo, a missing \label, or a part excluded by \includeonly. Prints ?? in the PDF.
- LaTeX Warning: There were undefined references.The end-of-run summary: some \ref or \cite did not resolve. Find the individual "Reference ... undefined" or "Citation ... undefined" lines above it.
- LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.Some label's number or page changed during this run, so references printed from the old .aux may be wrong. Compile again; if it never settles, look for a loop.
- LaTeX Warning: Label `<label>' multiply defined.Two \label commands use the same name, so every \ref to it shows whichever came last. Rename one, and update the \ref commands that meant it.
- Repeated entry---line <n> of file <name>.bibTwo .bib entries share one citation key. BibTeX keeps the first and skips the other. Delete the duplicate or give it its own key.
- I was expecting a `,' or a `}'---line <n> of file <name>.bibA .bib entry is malformed, most often a missing comma between fields or a space in the key. BibTeX skips the rest of the entry.
Every example on this page was compiled with pdfLaTeX and BibTeX to check that it fails and is fixed as described. All LaTeX errors