[Tex/LaTex] Undefined control sequence error using biblatex (\blx@refcontext@context)

biblatexbibliographieserrors

I was tasked with sifting through a paper and getting rid of all the errors (exciting, I know). The only error I could not figure out is the following:

! Undefined control sequence.
<argument> ...\blx@tempe @\blx@refcontext@context

l.14

? h
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

?

I've searched all over, but could not find a solution that worked. Here is an example of the code:

\documentclass[10pt,letterpaper]{article}
\usepackage[backend=biber, style=ieee ,defernumbers=true]{biblatex}
\usepackage{float} % Allows for control of flat positions
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{gensymb}    

\addbibresource{bibliography.bib}
\printbibliography

\begin{document}

blablabla here's all the writing and stuff I took out. 
Oh, look, I'm citing some paper \cite{ganan1998generation}

\end{document}

For the bibliography.bib file, the way the author was calling in references is:

@article{ganan1998generation,
  title={Generation of steady liquid microthreads and micron-sized monodisperse sprays in gas streams},
  author={Ga{\~n}{\'a}n-Calvo, Alfonso M},
  journal={Physical Review Letters},
  volume={80},
  number={2},
  pages={285},
  year={1998},
  publisher={APS}
}

Other solutions online have stated that the issue comes from calling on multiple citations, but that is not the case here. I commented out all the \cite{bib1,bib2,etc} commands throughout the text and still got the same errors.

I should also mention that the undefined control sequence error is being thrown 8 times, all with a different <argument> description.

I'm not sure what is happening here and could use a hand. I've tried the solutions from the following pages: page 1, page 2, page 3

Best Answer

That error (not terribly clear, I'll give you that) happens because you are using \printbibliography in the preamble of the document. The command \printbibliography, as the name advertises, prints the bibliography, so it must appear after the \begin{document} (where you want the bibliography to appear).

That error appears before the usual Missing \begin{document} error because biblatex does a lot of processing of the bibliography at \begin{document}, so some commands (for example the one that raised the error) are not yet defined in the preamble.

Also the bibliography relies a lot on external (what Overleaf calls cached) files. Usually a failed compilation will result in an unusable file, which will persist on the error even if you fixed the problem, so it's a good idea to try deleting these files if something's not working.