I have installed fresh magento 2.1.0 in my wamp server 3.0 I have done with all changes required to install magento 2.1.0 in wamp and it's work fine.

Now I have created my theme on below path : D:\wamp\www\magento2.1\app\design\frontend\Ecommerce\m2-theme

In my theme I have copied whole D:\wamp\www\magento2.1\vendor\magento\theme-frontend-luma folder and change 3 important files theme.xml , registration.xml and composer.json.

Now I go to admin > content > design > configuration and my theme is showing there for Globle , Main website and main website store but when I assign my theme and do save it's show me an error that

Cannot read contents from file "D:/wamp/www/magento2.1/" Warning!file_get_contents(D:/wamp/www/magento2.1/): failed to open stream: No such file or directory

After getting this error I googled for my issue and I find this and this links but no luck.

So can anyone tell me what is the issue and how can I solve this issue?

2 Answers 2


Actually, it is related to the Email module as you can set the default Header and Footer templates for the Transactional Email in the last section of the configuration. And the issue is in the Email Module.


Find the file \vendor\magento\module-email\Model\AbstractTemplate.php and on line number 672 replace the if condition if ($storeId) with if ($storeId !== false).


When you are saving the Global Configuration for the Store, you can see in the url that the current scope id is 0 (admin/theme/design_config/edit/scope/default/scope_id/0/) This is important.

Now, when you save the configuration, Magento will try to validate the Header and Footer templates whether you change them or not, using the class Magento\Theme\Model\Design\Config. While doing so, Magento instantiates an object of class \Magento\Email\Model\Template which actually extends the class \Magento\Email\Model\AbstractTemplate.

Using this template class, Magento tries to emulate the template for the current scope. This is where the issue lies. You can find the code for this at line 670 of \Magento\Email\Model\AbstractTemplate.

public function emulateDesign($storeId, $area = self::DEFAULT_DESIGN_AREA) { if ($storeId) { // save current design settings $this->emulatedDesignConfig = clone $this->getDesignConfig(); if ( $this->getDesignConfig()->getStore() != $storeId || $this->getDesignConfig()->getArea() != $area ) { $this->setDesignConfig(['area' => $area, 'store' => $storeId]); $this->applyDesignConfig(); } } else { $this->emulatedDesignConfig = false; } }

Since the scope_id for the Global scope is 0 (Note: scope_id is being passed as storeId here), false is returned and Magento starts to look into adminhtml for the templates. Now all you have to do is change the if condition from if ($storeId) to if ($storeId !== false) and you will be able to save the configuration.

Final Note: I know that editing the core file is bad practice. I have done this as a temporary solution hoping that this issue is fixed in the coming updates.


You will need to copy the folder \vendor\magento\module-email\view\frontend\email to \vendor\magento\module-email\view\adminhtml\email. For some reason, it's looking in the adminhtml folder for the header.html file.


This worked for me.

  • no it's not proper solution. it's not related to email module.so I am not excepting this answer.
    – Dhaval
    Jul 19, 2016 at 6:54
  • @watson what about V.S solution?
    – Gem
    May 14, 2018 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.