In the following mwe I get two warnings: LaTeX Warning: Citation 'foo' on page 2 undefined on input line 29. and pdfTeX warning (ext4): destination with the same identifier (name{definition.1}) has been already used, duplicate ignored.
While the first is obvious I don't see where the second would come from. The second warning disappears if, e.g. the \newpage is removed or the wrong citation is removed or corrected or cleveref is removed. It also disappears if I use \newtheorem instead of thmtools and \declaretheorem.
Can somebody explain me why that warning occurs? I started out with a big document which contained all these things, hence my desire to know.
I researched similar questions like this, this, this and this but it seems to be something different. Also I respect the order of loading packages.
The MWE
\documentclass{scrbook}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{thmtools}
\declaretheorem[style=plain,parent=section]{theorem}
\declaretheorem[style=definition,qed=$\triangle$,sibling=theorem]{definition}
% \newtheorem{theorem}{Theorem}[section]
% \newtheorem{definition}[theorem]{Definition}
\usepackage{hyperref}
\usepackage{cleveref}
\begin{document}
\chapter{chap}
\section{Sec1}
\begin{definition}
Text
\end{definition}
\newpage
\section{Sec2}
The reference \cite{foo} is undefined.
\begin{definition}
Text
\end{definition}
\end{document}
\declaretheoremdirectives should occur afterhyperrefandcleverefare loaded. Make this change irrespective of any\newpagedirectives in the body of the document. – Mico Jan 29 '19 at 01:28