Site design preview in Ghost admin is blank

When I am using my custom theme, site design preview in Ghost panel becomes blank. Also, this error occurs in the console: Uncaught TypeError: Failed to execute 'serializeToString' on 'XMLSerializer': parameter 1 is not of type 'Node'. When I’m using Ghost free themes (Casper, Headline, Ruby), this error does not occur and design preview is showing up.
Developing on a local ghost installation (localhost).
Does anyone know why this is happening?

Your theme is broken. I’m not sure how or why.

Restore an older version of custom theme that work and then try making and testing changes to it slower. That way, if the condition happens again, you’ll know that one of your most recent changes was the trigger.

Thank you! I installed ghost-starter-theme again and found out that problem was in my auto code-formatter. It was deleting <!DOCTYPE html> in the beginning of default.hbs file, and because of that preview wasn’t working.