The following MWE compiles without errors or warnings and produces two tikz pictures:
\documentclass{article}
\usepackage{tikz}
\begin{document}
A picture:
\begin{tikzpicture}
\node[draw] (a) at (0,0) {A};
\node[draw] (b) at (1,0) {B};
\draw (a) -- (b);
\end{tikzpicture}
Another picture:
\begin{tikzpicture}
\node[draw] (a) at (0,0) {A};
\draw (a) -- (b); % note: coordinate (b) doesn't exist!
\end{tikzpicture}
\end{document}
I'm drawing a lot of complex diagrams and keep running into subtle problems because I don't realise I'm connecting to a coordinate that was defined in a previous diagram but not the current one.
In order to prevent this, I would really like compilation to halt with an error when this happens. Is there a way to make tikz stricter about this, so that such problems can be caught?

byou get an error forcorQor ... – David Carlisle Jul 08 '23 at 07:51(..)to(\foo ..)and arrange\foohas a different expansion in each tkz (eg via a counter).. ohname prefixin other comment does this internall – David Carlisle Jul 08 '23 at 08:29name prefixand a suitableevery picturekey, yes... – Rmano Jul 08 '23 at 08:31name prefixeasily enough. Feel free to vote to reopen though, if you or someone else wants to post a nice general way to do the automation. – N. Virgo Jul 08 '23 at 08:40(b)and(c)the top levelname prefixkey would have been reached eventually but Rmano's comment faster – David Carlisle Jul 08 '23 at 08:41