The “missing } inserted” LaTeX error means LaTeX expected a closing brace but did not find one. The hardest part about this error is that the line number in the error log is almost always wrong. It points to where LaTeX gave up looking for the brace, not where the brace should actually be. The real problem is usually dozens or even hundreds of lines earlier.
What you see:
! Missing } inserted.
}
l.185 \end{document}
In this example, the error says line 185, but the missing brace could be anywhere in the document. LaTeX kept reading, treating everything as part of the same argument, until it hit \end{document} and realized something was wrong.
Quick answer
Three ways to find the missing brace:
- Check your last edit. If the document compiled 10 minutes ago, the brace disappeared near whatever you last changed
- Use brace matching. In Overleaf, click any brace to highlight its partner. In VS Code, use Ctrl+Shift+\
- Read the “Runaway argument” line in the error log. It shows you the text LaTeX consumed while looking for the brace. The beginning of that text is where the brace should be
If you cannot find it, use the binary search method described below.
Why the Line Number Is Wrong
This is the core frustration with this error. If you forget a } on line 30, LaTeX does not notice immediately. It keeps reading, treating everything after line 30 as part of the same argument. It might not realize something is wrong until it hits \end{document} on line 185. The error says line 185, but the fix is on line 30.
This is why looking at the reported line is usually useless for this error. You need a different strategy to find the actual location.
Common Causes
Nested commands with one brace dropped. Commands inside commands are where braces go missing most often. \textbf{\textit{some text} is missing the outer closing brace. The more deeply nested your commands, the easier it is to lose track. Count the opening and closing braces on each line. They should match.
Multi-line commands. When a command argument spans multiple lines (like a long \title{}, \caption{}, or \footnote{}), the closing brace on the last line is easy to accidentally delete during editing. Look for any multi-line command above the reported error line that is missing its closing brace.
Missing brace inside an environment. A missing } inside a tabular, figure, or equation environment causes LaTeX to consume the \end{...} as part of the argument. This triggers a cascade: you see “missing }” followed by “missing \endgroup” or “\end{document} ended by \endgroup.” The root cause is a single missing brace inside an environment earlier in the file.
Broken macro definitions. Custom commands defined with \newcommand are especially prone to brace mismatches because the definition itself contains braces that are separate from the argument braces. For example, \newcommand{\highlight}[1]{\textbf{\textcolor{red}{#1}} is missing the final } that closes the \newcommand. These errors only appear when you use the command, not when you define it, so the error line points to the usage, not the definition.
We fix all LaTeX compilation errors, including the hard-to-find ones.
Upload your .tex file. We trace every error to its source and deliver a clean-compiling document.
How to Find the Missing Brace
Method 1: Use Your Editor’s Brace Matching
In Overleaf, click on any brace and its matching partner highlights. If you click an opening { and nothing highlights, or the wrong closing } highlights, you have found the mismatch. In VS Code with the LaTeX Workshop extension, press Ctrl+Shift+\ to jump between matching braces. In TeXstudio, use Edit, Go to Matching Brace (Ctrl+Shift+B).
Method 2: Read the “Runaway Argument” Line
If the error log says Runaway argument? followed by a snippet of your document text before the “missing }” error, LaTeX is showing you the text it consumed while looking for the brace. The beginning of that snippet is exactly where the missing brace should be. This is the most useful piece of information in the entire error log.
Method 3: Binary Search the Document
If the document is long and you cannot find the brace visually, comment out the bottom half of your document with % and recompile. If the error disappears, the missing brace is in the bottom half. If it persists, it is in the top half. Keep halving until you isolate the section that causes it. This takes 4-5 compiles for even a 50-page document and always works.
Method 4: Check Your Last Edit
If your document compiled recently and now it does not, the brace disappeared near whatever you last changed. In Overleaf, use the History panel to see your recent edits. In Git, run git diff. The missing brace is almost always within a few lines of a recent change.
For other common LaTeX errors, see our complete guide to LaTeX compilation errors. The TeX FAQ also covers brace matching strategies for complex documents.
Frequently Asked Questions
LaTeX reports the line where it realized something was wrong, not where the missing brace actually is. If a closing brace is missing on line 30, LaTeX keeps reading, treating everything as part of the same argument, until it reaches \end{document} and has no choice but to stop. The fix is almost always much earlier in the document. Use brace matching, the “Runaway argument” log line, or the binary search method to find the actual location.
A “Runaway argument” message appears when LaTeX consumed far more text than expected while looking for a closing brace. The text shown after “Runaway argument?” is the content LaTeX read as part of the unclosed argument. The beginning of that text is exactly where the missing brace should be. This is the most direct clue the error log gives you for finding mismatched braces.
Click on any brace (opening or closing) in the Overleaf editor and its matching partner will be highlighted. If clicking an opening brace does not highlight a closing brace, or highlights the wrong one, you have found the mismatch. For large documents, you can also use Ctrl+Shift+K to jump between matching brackets and braces.