The Begin/End Macro Validator checks that every \begin{...} in your LaTeX file has a corresponding \end{...}. It walks the entire document tree and uses a stack to track open environments. If any \begin remains unmatched after processing, the validator reports an error.
You will see this error when one or more \begin macros do not have a matching \end:
Unmatched \begin on line 5, 12
The error message includes the line numbers of all unmatched \begin macros to help you locate them quickly.
There are a few typical reasons this error appears:
\end tag — You opened an environment but forgot to close it.\begin{...} and \end{...} don't match, e.g. \begin{itemze} vs \end{itemize}.\end line was removed during editing.Make sure every \begin{environment} has a matching \end{environment} with the exact same name. Environments must be properly nested — they cannot overlap.
Before (incorrect):
\begin{enumerate}
\item First item
\begin{itemize}
\item Sub-item
\end{enumerate}
\end{itemize}
After (correct):
\begin{enumerate}
\item First item
\begin{itemize}
\item Sub-item
\end{itemize}
\end{enumerate}
If you have a large document and the error is hard to track down, try collapsing or folding environments in your editor to visually verify that each \begin pairs with the correct \end.
For a deeper understanding of how LaTeX macros and environments work, see How TeX macros actually work on Overleaf.