[Tex/LaTex] Hyperref option clash error because unknown package requires/loads it too

errorshyperrefloggingoption-clashpackages

I am currently hunting for errors in my template and these two I cannot solve after reading the log and researching:

! LaTeX Error: Option clash for package hyperref.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.7 

The package hyperref has already been loaded with options:
  []

I already ruled out

  • Bibliography-styles requiring it
  • Package not loaded last
  • Putting global hyperref options in Documentclass options (even more errors)

My current knowledge is that some package/configuration file loads/requires hyperref. Therefore I looked at the log-file. But as a beginner I cannot decipher (a) which package causes the problem and (b) how I can solve/bypass it.

Minimal example:

\documentclass[a4paper, 12pt, oneside]{book}

\usepackage{bookmark}
\usepackage[
    ocgcolorlinks=false, %sample
]{hyperref}

\hypersetup{   
    urlcolor=red, %sample
}

\makeatletter
    \if@twoside
        \hypersetup{pdfpagelayout=TwoPageLeft, linkcolor=red}
        \fi
\makeatother

\begin{document}

This is a test.

\end{document}

Best Answer

Loading bookmark after hyperref solves the error.

See Bookmark-Documentation on page 7.