Why do I get an error after adding a .theme file? After creating (e.g empty) .theme file in my template folder, I get the following error message:


  The website encountered an unexpected error. Please try again later.RuntimeException: Failed to start the session because headers have already been sent by "/homepages/d825952918/htdocs/themes/universaldenker/universaldenker.theme" at line 1. in Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 145 of vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php).


If I delete the .theme file, everything works again. I think it has something to do with opcache, because the path "/homepages/d825952918/htdocs/themes/universaldenker/universaldenker.theme" comes from the .opcache folder.

How can I tell Drupal not to use it and clear all the cached files?
I suspect that your .theme file was not actually empty. Please try the experiment again and check the file size. If it is 3, then your file starts with a Unicode byte order mark (BOM). 

The BOM is typically invisible in editors, but it gets sent to the browser before Drupal internally calls the header() function. This causes the error message you have seen.

From a glance on your paths, I would not conclude that the OPcache plays a role here.