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 command

What 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.

Fails
\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}
Fixed
\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

Every example on this page was compiled with pdfLaTeX and BibTeX to check that it fails and is fixed as described. All LaTeX errors