Problems combining tikz and storebox: Missing number, treated as zero. With animate, page shipped out with text `graphicx`,

There is a bug in storebox.sty:

\AtBeginDocument{%
    \@ifpackageloaded{pgf}{\RequirePackage{storebox-pgf}{}}%
}

should be

\AtBeginDocument{%
    \@ifpackageloaded{pgf}{\RequirePackage{storebox-pgf}}{}%
}

When TeX executes this piece of code, it looks for the third argument to \@ifpackageloaded and it finds \ifnum which comes just after \@begindocumenthook in the code for \document. So this \ifnum is gobbled because pgf is loaded by tikz and what happens is that TeX sees

\topskip>1sp

which is meaningless. Indeed the error is “Missing number, treated as zero” because > is out of place. After this one has the usual error “Illegal unit of measure (pt inserted)” and then “Extra \fi”.

This explains why you have no error when tikz is not loaded: \@ifpackageloaded will follow the false branch, thus reinserting the \ifnum it mistakenly took as the third argument to \@ifpackageloaded.

You can temporarily fix it by adding

\AtBeginDocument{{}}

just after \usepackage{storebox}, which will provide the required empty argument for \@ifpackageloaded.

\documentclass[12pt]{article}%{standalone}
\usepackage{tikz}
\usepackage{storebox}
\AtBeginDocument{{}}
\usepackage{animate}

\begin{document}
Test
\end{document}