I eventually tracked this down to the following lines in my app/design/frontend/vendor-name/theme-name/Magento_Theme/layout/default.xml where I am adding the classes header and links to the <ul> tag for the panel header:
<referenceContainer name="header.panel"> <block class="Magento\Framework\View\Element\Html\Links" name="header.links"> <arguments> <argument name="css_class" xsi:type="string">header links</argument> </arguments> </block> </referenceContainer>
I have no idea why this causes an error. I found the following does the same but without the error (I've highlighted the change from above in upper case although in reality it needs to be lower case). Again I have no idea why this is more successful! Can anyone explain what's happening please?
<referenceContainer name="header.panel"> <block class="Magento\Framework\View\Element\Html\Links" name="CUSTOMER-ACCOUNT-LOGIN"> <arguments> <argument name="css_class" xsi:type="string">header links</argument> </arguments> </block> </referenceContainer>