You need to protect \includegraphics
inside \caption
; this, however, will add the image also to a possible list of figures, so perhaps you would rather use the optional argument of \caption
; in this case, no protection is needed. The following example code shows both alternatives:
\documentclass{article}
\usepackage[demo]{graphicx}% demo option just for the example
\begin{document}
\listoffigures
\begin{figure}
\centering
\caption{text with \protect\includegraphics[height=1cm]{icon} somewhere inside}
\includegraphics{image}
\end{figure}
\begin{figure}
\centering
\caption[text for the LoF]{text with \includegraphics[height=1cm]{icon} somewhere inside}
\includegraphics{image}
\end{figure}
\end{document}