Mage registry key "_singleton/" already exists error

Mage registry key "_singleton/" already exists error

August 3, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Mage registry key "_singleton/" already exists error

Error Analysis: Identifying the Mage Registry Key Conflict

The provided Magento configuration and observer setup for customizing product pricing is causing a registry key conflict that results in the error: Mage registry key "_singleton/" already exists. Let’s break down the issue step by step.

Understanding the Core Issue

Magento uses an event-driven architecture, allowing developers to add observers to specific events. In your configuration XML:

<events>
    <core_block_abstract_to_html_after>
        <observers>
            <type>singleton</type>
            <class>WebDirect_CustomPrice_Model_Observer</class>
            <method>convertPricespanToInput</method>
        </observers>
    </core_block_abstract_to_html_after>
</events>

You’ve registered an observer using the singleton type. This means Magento will instantiate a single instance of this observer class for each unique event it’s attached to.

The problem arises because you’re also defining an observer in your Magento setup that is probably registered with the same singleton type:

<events>
    <catalog_product_view>
        <observers>
            <type>singleton</type>
            <class>WebDirect_CustomPrice_Model_Observer</class>
            <method>convertPricespanToInput</method>
        </observers>
    </catalog_product_view>
    ...
</events>

Both observer configurations use the same WebDirect_CustomPrice_Model_Observer class and are registered with the singleton type. Since Magento can only have one singleton instance per key, this causes a conflict when both events fire.

The Core Block to HTML After Event

The core event core_block_abstract_to_html_after is fired after a block has been converted from its abstract form to an HTML string for rendering on the page. Your observer is attached to this event, but it seems like there’s no corresponding event in your Magento configuration.

To resolve this issue, ensure you have the following configuration:

<events>
    <core_block_abstract_to_html_after>
        <observers>
            <type>singleton</type>
            <class>Your_Custom_Observer_Model</class>
            <method>yourCustomObserverMethod</method>
        </observers>
    </core_block_abstract_to_html_after>
</events>

Replace Your_Custom_Observer_Model with the actual class name of your observer and yourCustomObserverMethod with the method you want to execute.

Conclusion

The error occurs due to a conflict in singleton observers. To resolve this, ensure that:

  1. You have a unique observer configuration for each event.
  2. Each observer is tied to a different instance or uses a different class.
  3. If you’re using singletons, make sure the key doesn’t overlap with any other observer’s key.

Remember, Magento’s event-driven architecture is powerful but requires careful management of observers and their corresponding configurations. Always ensure uniqueness when working with singleton observers.

For more detailed information on Magento events and observers, consider visiting Laravel Company’s guide to Magento development.

Catalog Extensions Configuration Pricing

Our network