When clicking on Magento Connect Manager from admin, facing this error: Mage registry key "_singleton/admin/session" already exists

  • Try using full name of class instead of a modelized one. Helped in my case. – Roomy Feb 25 '15 at 19:46

I don't have a solution, but I can explain why/when this is happening.

TL;DR: In your case the model admin/session is not instantiated or does not exist and Mage::getModel('admin/session') returns false

Full explanation

There is a bug (or better yet an inconsistency) in the Mage::getSingleton method.
It has been there for ages.

The method looks like this:

public static function getSingleton($modelClass='', array $arguments=array())
    $registryKey = '_singleton/'.$modelClass;
    if (!self::registry($registryKey)) {
        self::register($registryKey, self::getModel($modelClass, $arguments));
    return self::registry($registryKey);

Now let's take a look at the Mage::register method

public static function register($key, $value, $graceful = false)
    if (isset(self::$_registry[$key])) {
        if ($graceful) {
        self::throwException('Mage registry key "'.$key.'" already exists');
    self::$_registry[$key] = $value;

Notice the throwException. It is exactly what you see as error message. If there is already a value in the registry for a certain key, you get an error.
In your case you get this error because there is already a value for key _singleton/admin/session. This happens in one case.
Going back to the getSingleton method, this is the bug/inconsistency:

 if (!self::registry($registryKey)) {

This condition will return true when the value you registered for a specific key is null, false, 0.
This happens when getModel returns false. (when a model class is not found).

You should check if you have extensions rewriting the admin session class, or you can debug starting from the methods above to see why you are getting this error.

  • I'm encountering the same issue with overriding catalogSearch class. I'm overriding in following way in global section config.xml of custommodule: <models> <catalogsearch> <rewrite> <layer>MY_Custommodule_Model_CatalogSearch_Layer</layer> </rewrite> </catalogsearch> </models> – R T Oct 9 '15 at 6:50
  • see here for a slightly clearer explanation. It seems the overriding classes don't necessarily find the original class being instantiated by getSingleton – tzvi Nov 19 '15 at 23:42
  • HI Marius, what would be the fix for this bug? if (!self::registry($registryKey)) { – snh_nl Nov 6 '17 at 9:44
  • 1
    There shouldn't be a fix I think. you should just make sure that all your objects called via getSingleton are objects anyway – Marius Nov 6 '17 at 9:56
  • Aha! I also saw LTS is suggesting a pull around this - maybe you are interested. github.com/OpenMage/magento-lts/pull/368 – snh_nl Nov 6 '17 at 15:22

If you have maintenance mode ON, make it off . clear cache. and retry to access Magento connect manager. Hope that will work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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