Compiler Error with pgfplots package

my code suddenly stopped compiling and getting this errors:

File ended while scanning definition of \pgfplots@show@ref@Gain.

} l.89 \begin{document} I suspect you have forgotten a }', causing me to read past where you wanted me to stop. I'll try to recover; but if the error is serious, you'd better type E' orX' now and fix your file. thesis.tex, line 89

Illegal parameter number in definition of \pgfplots@show@ref@Gain.

1 l.89 \begin{document} You meant to type ## instead of #, right? Or maybe a } was forgotten somewhere earlier, and things are all screwed up? I'm going to assume that you meant ##. thesis.tex

File ended while scanning definition of \pgfplots@show@ref@Gain.

} <*> thesis.tex I suspect you have forgotten a }', causing me to read past where you wanted me to stop. I'll try to recover; but if the error is serious, you'd better type E' orX' now and fix your file.

! Emergency stop. <*> thesis.tex

*** (job aborted, no legal \end found)

To be sure, I also tried to compile a backup file that I compiled with no errors two days ago and it, now, gives me the same errors. I am currently using overleaf. Am I the only one getting this error? Is it possible that there is some problem with overleaf loading the pgfplots packages? Or am I missing something? The whole code is more than 2000 lines, should I attach that as well?

\documentclass[12pt, oldfontcommands]{memoir}
\usepackage[table]{xcolor}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{indentfirst}
\usepackage[english]{babel}
\usepackage{fancyhdr}
\usepackage{amssymb}
\usepackage[sorting=none]{biblatex}
\usepackage{csquotes}
\newcommand{\parallelsum}{\mathbin{\!/\mkern-5mu/\!}}
\usepackage{pgfplots}
\pgfplotsset{width=8cm,compat=1.9}
\usepackage{longtable}
\usepackage[acronym]{glossaries}
\usepgfplotslibrary{statistics}
\usepackage{rotating}
\usepackage{tikz}

\newacronym{OTA}{OTA}{Operational Transconductance Amplifier}
\newacronym{PWM}{PWM}{Pulse Width Modulation}
\newacronym{SDM}{SDM}{Sigma Delta Modulation}
\newacronym{CMRR}{CMRR}{Common Mode Rejection Ratio}
\newacronym{PSRR}{PSRR}{Power Supply Rejection Ratio}
\newacronym{LPWM}{LPWM}{Linear Pulse Width Modulation}
\newacronym{SR}{SR}{Slew Rate}
\newacronym{THD}{THD}{Total Harmonic Distortion}
\newacronym{IA}{IA}{Instrumentation Amplifier}
\newacronym{CFIA}{CFIA}{Current Feedback Instrumentation Amplifier}
\newacronym{GBW}{GBW}{Gain BandWidth}
\newacronym{FVF}{FVF}{Flipped Voltage Follower}
\newacronym{CMFB}{CMFB}{Common-Mode Feedback}

\makeglossaries

\usepackage{float}
\usepackage{amsmath}
\usepackage{mathtools}

\definecolor{light-gray}{gray}{0.85}
\usepackage[
bookmarks=true,bookmarksopenlevel=2]{hyperref}

\usepackage{geometry}
\geometry{total={210mm,297mm},
left=20mm,right=20mm,
bindingoffset=10mm, top=25mm,bottom=25mm}

\OnehalfSpacing

\pagestyle{plain}
\makepagestyle{plain}
\makeevenfoot{plain}{\thepage}{}{}
\makeoddfoot{plain}{}{}{\thepage}

\maxsecnumdepth{subsection}
\maxtocdepth{subsection}

\begin{document}


The errors are at the same line of \begin{document} and they refer to "\pgfplots@show@ref@Gain." and to a "##" that is a character never used in the code. I also tried to remove all pgfplots or related packages and I still get the same error.

• You'll need to show us some code, otherwise we cannot help much. Since it is mentioning \begin{document} you have have something in your preamble where for example a } is missing, but without code there is no way to be more exact – daleif Nov 22 '18 at 14:34
• If the error shows up only in this project i.e. pgfplogts works fine in your other projects, the problem may be something else within your Overleaf project. Can you try identify the code portion that's causing this, so that you can make a small complete code example to post here? If not, you can email support@overleaf.com with your project's URL; someone will then have a look. – LianTze Lim Nov 22 '18 at 14:58