Twig\Error\SyntaxError: Unexpected character "&". in Twig\Lexer->lexExpression() (line 1 of node--event--full.html.twig).

I encountered this error when developing my website in Drupal 10.

Twig\Error\SyntaxError: Unexpected character "&". in Twig\Lexer->lexExpression() (line 1 of node--event--full.html.twig).

How I solved this 

As it appears, and from lookup of this error as well, it has something to do with copy-pasting. So what I did was create the file, and copy-paste my default node.html.twig to my node--event--full.html.twig. This kept giving me the error. 

When I just copy the file (and not the contents), it works. So, just copy node.html.twig and name to node--event--full.html.twig instead of copying the contents.

A weird error I must say!

 

Saved you some valuable time?

Buy me a drink 🍺 to keep me motivated to create free content like this!