I was expecting a `,' or a `}'---line <n> of file <name>.bib
A .bib entry is malformed, most often a missing comma between fields or a space in the key. BibTeX skips the rest of the entry.
Help centre › LaTeX errors › References and bibliography · Error: the build stops or the output is wrong
What the log says
Database file #1: refs.bib
I was expecting a `,' or a `}'---line 4 of file refs.bib
:
: title = {Measuring Things Carefully},
(Error may have been on previous line)
I'm skipping whatever remains of this entryWhat it means
BibTeX reads each entry as a key followed by fields of the form name = value, separated by commas. After a key or a value it expects either a comma (another field follows) or the closing brace of the entry. It found something else, so it gives up on the rest of that entry. Fields after the error are lost and the entry may come out incomplete.
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. A comma is missing at the end of the previous field
The line BibTeX names is usually the field after the mistake, which is why it adds "Error may have been on previous line". Add the comma at the end of the field above.
\begin{filecontents*}[overwrite]{refs.bib}
@article{smith2020,
author = {Smith, Jane}
title = {Measuring Things Carefully},
journal = {Journal of Measurement},
year = {2020}
}
\end{filecontents*}
\documentclass{article}
\begin{document}
As shown by \cite{smith2020}, the effect is small.
\bibliographystyle{plain}
\bibliography{refs}
\end{document}\begin{filecontents*}[overwrite]{refs.bib}
@article{smith2020,
author = {Smith, Jane},
title = {Measuring Things Carefully},
journal = {Journal of Measurement},
year = {2020}
}
\end{filecontents*}
\documentclass{article}
\begin{document}
As shown by \cite{smith2020}, the effect is small.
\bibliographystyle{plain}
\bibliography{refs}
\end{document}2. The citation key contains a space
A key ends at the first space. Remove spaces from keys (smith2020, smith_2020) and update the \cite commands to match.
\begin{filecontents*}[overwrite]{refs.bib}
@article{smith 2020,
author = {Smith, Jane},
title = {Measuring Things Carefully},
journal = {Journal of Measurement},
year = {2020}
}
\end{filecontents*}
\documentclass{article}
\begin{document}
As shown by \cite{smith2020}, the effect is small.
\bibliographystyle{plain}
\bibliography{refs}
\end{document}\begin{filecontents*}[overwrite]{refs.bib}
@article{smith2020,
author = {Smith, Jane},
title = {Measuring Things Carefully},
journal = {Journal of Measurement},
year = {2020}
}
\end{filecontents*}
\documentclass{article}
\begin{document}
As shown by \cite{smith2020}, the effect is small.
\bibliographystyle{plain}
\bibliography{refs}
\end{document}3. A value contains a double quote inside a quoted value
In title = "…", an inner " ends the value early. Delimit the value with braces instead, title = {The "best" method}, or write the inner quotes as ` ` ` and ''`.
4. Braces in a value are unbalanced
Every { in a value needs its }. An extra or missing brace shifts where BibTeX thinks the field ends. Count the braces in the field named in the message and the one before it.
In Manulyx
The editor reports the error at the line of the .bib file BibTeX names, with an explanation, and lists the citations it leaves undefined under it.
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.
- I couldn't open database file <name>.bibBibTeX cannot find the .bib file named in \bibliography. Check the spelling and folder, and write the name without the .bib extension.
- I found no \bibdata commandBibTeX read the .aux file and found no \bibliography, no \cite or no \bibliographystyle. Add the missing command, or run biber for biblatex.
Every example on this page was compiled with pdfLaTeX and BibTeX to check that it fails and is fixed as described. All LaTeX errors