I am writing my Master's thesis using a LaTex template provided by the university. For the most part, I write locally and sync changes with an Overleaf project in order to collaborate with my supervisors. After getting almost the whole paper written, I can't even compile a simple example because of an "Extra \endgroup." error. I have reproduced the error here. It is view-access-only, so if you want to debug, please, copy the project (remember to use XeLaTex compiler).
I also include the code here:
\documentclass[a4paper,twoside,11pt]{report} %openright
\usepackage{microtype} % better looking text
\usepackage{fontspec} % Package for custom fonts
\usepackage[]{geometry} % Package for changing page margins (before fancyhdr)
\usepackage{fancyhdr} % Package to change header and footer
\usepackage{parskip} % Package to tweak paragraph skipping (instead of indents a small skip is added after every paragraph)
\usepackage{titlesec}
\usepackage{tikz} % Package for drawing
\usepackage{pgfplots} % Package for creating graphs and charts
\usepackage{xcolor} % Package for defining DTU colours to be used
\usepackage{amsmath} % For aligning equations among other
\usepackage{siunitx} % SI units
\usepackage{listings} % Package for inserting code, (before cleveref)
\PassOptionsToPackage{hyphens}{url} % Ability to line break urls at hyphens
\usepackage{hyperref} % Package for cross referencing (also loads url package)
\usepackage{cleveref} % improved cross referencing
\usepackage{textcomp} % \textdegree = °C and other useful symbols
\usepackage[english]{babel} % localisation
\usepackage{caption} % better captions
\usepackage{subcaption} % for subfigures
\usepackage{csquotes} % For biblatex with babel
\usepackage[backend=biber,style=authoryear,sorting=none]{biblatex} % Package for bibliography (citing)
\usepackage{tabularx} % for ability to adjust column spacing in tabular better
\usepackage{booktabs} % for better tables
\usepackage{float} % floating figures in correct places
\usepackage{calc} % Adds ability for latex to calculate (3pt+2pt)
\usepackage[printwatermark=false]{xwatermark} % Package for wartermark. Toggle printwatermark true or false to include or remove the watermark
\usepackage{blindtext}
\begin{document}
\chapter{Test}
Lorem ipsum dolor sit amet
\end{document}
main.log from my local machine can be found here.
I have seen this question and the fix from the comments works for me, however, it introduces another error (see my question here).
What am I doing wrong?