Skip to content
Get started

Fix "Runaway argument" and "Paragraph ended before" in LaTeX

These errors mean a command’s argument was opened with { but never closed with }, so LaTeX kept reading until it hit a blank line or the end of the file. You will learn how to find the missing brace.

When the argument runs into a blank line:

Runaway argument?
{fig:results for the details.
./main.tex:4: Paragraph ended before \@kernel@ref was complete.

When it runs to the end of the file:

Runaway argument?
{an unclosed bold group. \par A new paragraph starts here. \end {docu\ETC.
! File ended while scanning use of \textbf .

The line after Runaway argument? shows the start of the argument that was never closed. That is the place to look.

  • A missing } at the end of an argument, for example \ref{fig:results or \textbf{word.
  • A } typed as ) or ] by mistake.
  • A blank line inside an argument that does not allow paragraphs, such as \ref, \cite or \label.
main.tex (broken)
\documentclass{article}
\begin{document}
See Figure~\ref{fig:results for the details.
The next paragraph starts here.
\end{document}

Close the argument where it should end:

main.tex (fixed)
\documentclass{article}
\begin{document}
See Figure~\ref{fig:results} for the details.
The next paragraph starts here.
\end{document}
  • The code editor highlights matching brackets and closes { for you as you type, which makes a missing } easier to spot.
  • For “File ended while scanning use of …”, the error summary in the Output panel shows the hint “A { or an argument is never closed. Check the braces before this point.”

Not on Luzbase yet? It compiles LaTeX in your browser and links each error to its line, often with the fix. Start writing free.