He tells you that you can't use figure if you aren't in outer par
mode. TeXbook says that they are six modes:
1. Vertical mode (inside the page)
2. Internal vertical mode (inside \vbox)
3. Horizontal mode (inside a paragraph)
4. Internal horizontal mode (inside a \hbox)
5. Math mode (inside $...$)
6. Display math mode (inside $$...$$ (for TeX))
figure, table and any float must be specified inside mode 1 or 3. TeX
(LaTeX in fact) raises this error when a float is specified in mode 2,
4, 5, or 6 (well not with 6 but it's a bit technically).
This M(W)E:
-----%<----------%<----------%<----------%<-----
\documentclass{article}
\begin{document}
Somme text
\vbox{\begin{figure} hello \end{figure}}
\hbox{\begin{figure} hello \end{figure}}
\begin{minipage}{5cm}
\begin{figure} hello \end{figure}
\end{minipage}
Some math: $a=b \begin{figure} a=b \end{figure}$
\end{document}
-----%<----------%<----------%<----------%<-----
shows 4 errors `not in outer par mode'.
Where is your 158th lines? Inside what?
Jean-Côme Charpentier