LaTeX Error: \begin{itemize} ended by \end{enumerate} — Environment closed with the wrong \end
A \begin{a} is closed by \end{b}.
Fix
Make each \end{…} match the innermost open \begin{…}.
Example
Reproduced on TeX Live 2026 by CI · xelatex · corpus/environment-mismatch
\begin{itemize} closed with \end{enumerate}
main.tex\documentclass{article}
\begin{document}
\begin{itemize}
\item Collect data.
\item Train the model.
\end{enumerate}
\end{document}\documentclass{article}
\begin{document}
\begin{itemize}
\item Collect data.
\item Train the model.
\end{itemize}
\end{document}main.log! LaTeX Error: \begin{itemize} on input line 3 ended by \end{enumerate}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.6 \end{enumerate}
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.