Zaraz double firing and console error

Zaraz Google Analytics 4 double firing and also getting console error Uncaught TypeError: Cannot read properties of undefined (reading ‘filter’)

Do you have E-commerce tracking API enabled? I had the same problem when having it enabled and adding zaraz tracking tags.
I changed the zaraz tracking tags to dataLayer instead which solved the issue, although I don’t know if zaraz is actually converting the dataLayer tags.

Found out the issue was because of malformed html, specifically having 2 head elements