Fix for Magento error – Item (Mage_Customer_Model_Customer) with the same id already exist

After upgrading to Magento I kept getting the following error when trying to go to the Customers screen. A similar error can also happen on other screens. It's when a Collection is being built, BUT there are duplicate entity_ids in the SQL results. To fix it, turn off the throw error.

Item (Mage_Customer_Model_Customer) with the same id "XXXX" already exist

Edit lib/Varien/Data/Collection.php
Find the addItem function and comment out the "throw" line :
public function addItem(Varien_Object $item)
        $itemId = $this->_getItemId($item);
        if (!is_null($itemId)) {
            if (isset($this->_items[$itemId])) {
                // throw new Exception('Item ('.get_class($item).') with the same id "'.$item->getId().'" already exist');
            } else {
                $this->_items[$itemId] = $item;
        else {
            $this->_items[] = $item;
        return $this;

Got this from


Leave a Reply