You are using the \href in the argument of some other command. This will break as \href no longer can change the catcode of the #. The exact error message depends on the outer command, but will normally report an Illegal parameter. In such cases you can excape the #:
\documentclass{article}
\usepackage{hyperref}
\begin{document}
%works fine:
\href{https://en.wikipedia.org/wiki/Ugarit#/media/File:Ugarit_02.jpg}{Loris Romito}
%fails:
%\textbf{\href{https://en.wikipedia.org/wiki/Ugarit#/media/File:Ugarit_02.jpg}{Loris Romito}}
%workaround: escape the #:
\textbf{\href{https://en.wikipedia.org/wiki/Ugarit\#/media/File:Ugarit_02.jpg}{Loris Romito}}
\end{document}
\documentclasscommand, have a minimal preamble and then\begin{document}...\end{document}. The code should compile and be as small as possible to demonstrate your problem. Cutting your code down to a MWE may well reveal what your problem actually is. – Apr 27 '17 at 00:15#happens to solve both. – user202729 Jul 29 '22 at 05:02