3

I'm getting this error and it is keeping me busy all day. I get it when I log in on the admin page. After going back to /admin I get the same error. The magento version is 1.7.x

things I have undertaken so far (among the things I still can remember)

  • clear browser cache
  • clear cache (db & files)
  • clear sessions
  • clear locks
  • execute

    TRUNCATE mage_dataflow_batch_export ; TRUNCATE mage_dataflow_batch_import ; TRUNCATE mage_log_customer ; TRUNCATE mage_log_quote ; TRUNCATE mage_log_summary ; TRUNCATE mage_log_summary_type ; TRUNCATE mage_log_url ; TRUNCATE mage_log_url_info ; TRUNCATE mage_log_visitor ; TRUNCATE mage_log_visitor_info ; TRUNCATE mage_log_visitor_online ; TRUNCATE mage_report_event ;

    the XXXXX is for customer's privacy


    There has been an error processing your request

    SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'

    Trace:
    #0 /var/www/vhosts/xxxxxx/httpdocs/lib/Varien/Db/Statement/Pdo/Mysql.php(111): Zend_Db_Statement_Pdo->_execute(Array)
    #1 /var/www/vhosts/xxxxx/httpdocs/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
    #2 /var/www/vhosts/xxxxxx/httpdocs/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
    #3 /var/www/vhosts/xxxxxxxx/httpdocs/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `adminnotification_inbox` (`severity`, `date_added`, `title`, `description`, `url`) VALUES (?, ?, ?, ?, ?)', Array)
    #4 /var/www/vhosts/xxxxxx/httpdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `adminnotification_inbox` (`severity`, `date_added`, `title`, `description`, `url`) VALUES (?, ?, ?, ?, ?)', Array)
    #5 /var/www/vhosts/xxxxxxxx/httpdocs/lib/Zend/Db/Adapter/Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `adminnotification_inbox` (`severity`, `date_added`, `title`, `description`, `url`) VALUES (?, ?, ?, ?, ?)', Array)
    #6 /var/www/vhosts/xxxxxxx/httpdocs/app/code/core/Mage/AdminNotification/Model/Resource/Inbox.php(120): Zend_Db_Adapter_Abstract->insert('adminnotification_inbox', Array)
    #7 /var/www/vhosts/xxxxxxx/httpdocs/app/code/core/Mage/AdminNotification/Model/Inbox.php(118): Mage_AdminNotification_Model_Resource_Inbox->parse(Mage_AdminNotification_Model_Inbox, Array)
    #8 /var/www/vhosts/xxxxxx/httpdocs/app/code/core/Mage/AdminNotification/Model/Feed.php(97): Mage_AdminNotification_Model_Inbox->parse(Array)
    #9 /var/www/vhosts/xxxxxx/httpdocs/app/code/core/Mage/AdminNotification/Model/Observer.php(50): Mage_AdminNotification_Model_Feed->checkUpdate()
    #10 /var/www/vhosts/xxxxxxxx/httpdocs/app/code/core/Mage/Core/Model/App.php(1338): Mage_AdminNotification_Model_Observer->preDispatch(Varien_Event_Observer)
    #11 /var/www/vhosts/xxxxxx/httpdocs/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Mage_AdminNotification_Model_Observer, 'preDispatch', Varien_Event_Observer)
    #12 /var/www/vhosts/xxxxxx/httpdocs/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('controller_action_predispatch', Array)
    #13 /var/www/vhosts/xxxxx/httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(528): Mage->dispatchEvent('controller_action_predispatch', Array)
    #14 /var/www/vhosts/xxxxxxx/httpdocs/app/code/core/Mage/Adminhtml/Controller/Action.php(160): Mage_Core_Controller_Varien_Action->preDispatch()
    #15 /var/www/vhosts/xxxxxx/httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(408): Mage_Adminhtml_Controller_Action->preDispatch()
    #16 /var/www/vhosts/xxxxxx/httpdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
    #17 /var/www/vhosts/xxxxxx/httpdocs/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Mage_Core_Controller_Request_Http)
    #18 /var/www/vhosts/xxxxxxx/httpdocs/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
    #19 /var/www/vhosts/xxxxx/httpdocs/app/Mage.php(683): Mage_Core_Model_App->run(Array)
    #20 /var/www/vhosts/xxxxx/httpdocs/index.php(89): Mage->run('', 'store')

I find 0 and PRIMARY odd in this case... thanks Thomas

4
  • All those truncates you did are the shotgun method in the hopes a pellet hits the target over your shoulder from a ricochet. The issue is with the adminnotification_inbox table which means that some notification from Magento or a third party module vendor suffered a double entry infarction when it was added to the admin System Notifications mailbox. Make sure you always do a database backup before doing any database maintenance. Being able to restore from a mildly broken database backup that can be repaired is "Golden". Feb 17, 2015 at 0:57
  • A yes, sorry guys, I also did some research on the adminnotification_inbox. But I was under the impression that, since I disabled the AdminNotification, it couldn't be the source of the problem. I will look into it this morning and report back. thanks Fiasco Labs, yes I always make Database backups. Indeed, it is Golden Feb 17, 2015 at 6:34
  • The only way to properly completely disable a module is to look in the appropriate module .xml file in app/etc/modules and change the value between the active tags to false, then pray there are no dependencies. The disable in system config advanced only disables output, doesn't prevent table access. If any foreign keys exist to that table, they will result in a check fault as well. Kudos on the db backup. Feb 17, 2015 at 17:28
  • @FiascoLabs . Yes I do backups regulary. But in this case something went incredibly wrong. Not only the auto-increment of the 'adminnotification_inbox' is gone but every table that originally had a primary key with a-i has lost the a-i! Feb 18, 2015 at 8:50

3 Answers 3

3

It sounds like auto-increment is disabled on the primary-key of that table.

That or the data-type is wrong.

6
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. Feb 17, 2015 at 3:57
  • 2
    This answer is actually the closest. However, auto increment is most likely enabled, but at max integer value, rolling over to -1 but never getting altered. Easiest way to restore the table is to drop it and recreate the definition without the AUTO_INCREMENT table property.
    – user4351
    Feb 17, 2015 at 8:35
  • @RKT-JoinMageStackDay2015, technically there was no question to answer. OP made a statement, I responded with 2 possible causes to the error posted. Feb 17, 2015 at 8:44
  • @thomas-coucke, can you provide a dump of the table structure? Feb 17, 2015 at 8:45
  • 1
    Ok guys this is what was going on. Before I posted the question here I had emptied the adminnotification table but with the same error. Now I have emptied it and enabled the a-i of the primary key. Now the admin works fine! However, during my search for a solution I didn't mind the adminnotification table because I switched of the adminnotification in the backend (config->advanced->disable). So how did the table get populated? In anyway, thank you all for the thinking and proposed solutions! Feb 17, 2015 at 9:11
1

This error seem to have something to do with AdminNotification

So take a look at db tables

  • adminnotification_inbox
0

Issue fixed

  1. auto-increment is disabled on the primary-key of log_visitor_info table.
  2. change default to none and attribute to empty

Your Answer

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

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