Recoverable Error: Argument 1 passed to Mage_Core_Model_Store :: setWebsite() must be an instance of Mage_Core_Model_Website

Friday, 4. November 2011

When upgrading Magento to the latest version, I stumbled upon this error:

Recoverable Error: Argument 1 passed to Mage_Core_Model_Store::setWebsite() must be an instance of Mage_Core_Model_Website, null given, called in /path/app/code/core/Mage/Core/Model/App.php on line 427 and defined in /path/app/code/core/Mage/Core/Model/Store.php on line 279

To fix this issue:

1) Navigate to the following file and delete it.

app/etc/use_cache.ser

If problem persists: here is what you will need to do. Basically, your current database has the admin store id greater than 0. This script should be run via phpmyadmin or similar tool.

SET FOREIGN_KEY_CHECKS=0;
UPDATE `core_store` SET store_id = 0 WHERE code='admin';
UPDATE `core_store_group` SET group_id = 0 WHERE name='Default';
UPDATE `core_website` SET website_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';
SET FOREIGN_KEY_CHECKS=1;

Leave a Reply

You must be logged in to post a comment.