I have an overleaf project which compiles just fine, it comprises of a main file which inputs multiple smaller chapter files. I have installed TeXlive 2022 on Windows and tried using both VScode plugins and TeXStudio, and no matter what I get hundreds of errors all looking like this:
The document in question here is this:
\begin{titlepage}
\center
\begin{center}
\includegraphics[width=100mm]{title/unnamed.png}\\[0cm]
\end{center}
\ifdefined\school
\large \textsc{\school}\\[1.5cm] % Minor heading such as course title
\ifdefined\department
\large \department\\[1.5cm] % Minor heading such as course title
\fi
\makeatletter
{\setstretch{0.8} \Huge\bfseries \textsc{\thesistitle} \par\vspace{\baselineskip}} % Title of your document
\textsc{Author: \authorname (ID: )}\\[0cm] % Your name and Student ID
\textsc{Project Supervisor: }\\[0cm] %Project Supervisor Name
\textsc{Project Assessor: }\\[1cm] %Project Assessor Name
\vspace{1.9cm}
\normalsize
\section*{\RaggedRight Declaration}
I confirm that I have read and understood the University’s Academic Integrity Policy.\\
I confirm that I have acted honestly, ethically and professionally in conduct leading to assessment for the programme of study.\\
I confirm that I have not copied material from another source nor committed plagiarism nor fabricated, falsified or embellished data when completing the attached piece of work. I confirm that I have not copied material from another source, nor colluded with any other student in the preparation and production of this work.
Signed: -- \hfill
\vspace{1cm}
\textsc{{\large July, 2022}}\\[2cm] % Date
\vspace{1cm}
\vfill
\end{titlepage}
All of the macros are defined correctly, and indeed the project compiles perfectly on overleaf.
Even if I randomly delete half of the lines of the document until this particular set of errors disappears, the next file will have the exact same issue.
I'm not sure how to fix this. I appreciate any help.