I'm trying to do some site development on my dev copy of the site, but I'm seeing the following error, both in the browser and in drush commands like drush cc all:

Sorry but we are not able to provide this at the moment.
DB Error: unknown error

I get this on every page in the browser, e.g. the home page. I'm suspecting CiviCRM is a culprit here, because I see that sites/all/modules/civicrm/packages/DB.php defines DB_ERROR as the string "unknown error".

How can I debug further? Can I get drush or php to give me a stack trace somehow?

I'm using Drupal 7.41 with CiviCRM 4.6.8.

EDIT: If I fire up a shell with php -a and paste in the contents of index.php, I get the error when it runs menu_execute_active_handler();. However, if I run that function again then I get the home page, seemingly correctly rendered. Not sure what that means.

EDIT 2: Following up on Alan's suggestion, I did try manually adding database rows as follows, but it didn't give me any traces:

insert into civicrm_setting set group_name='Developer Preferences', name='backtrace',
  value='s:1:"1";', domain_id=1, contact_id=NULL, is_domain=1, component_id=NULL;
insert into civicrm_setting set group_name='Developer Preferences', name='debug_enabled',
  value='s:1:"1";', domain_id=1, contact_id=NULL, is_domain=1, component_id=NULL;

EDIT 3 @JitendraPurohit pointed me to a log file (I didn't realize CiviCRM had its own separate log directory!) that contains a stack trace, here it is:

Nov 02 08:22:43  [info] $Fatal Error Details = Array
    [callback] => Array
            [0] => CRM_Core_Error
            [1] => handle

    [code] => -1
    [message] => DB Error: unknown error
    [mode] => 16
    [debug_info] => SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._', 3 ) [nativecode=3057 ** Incorrect user-level lock name 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._'.]
    [type] => DB_Error
    [user_info] => SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._', 3 ) [nativecode=3057 ** Incorrect user-level lock name 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._'.]
    [to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._', 3 ) [nativecode=3057 ** Incorrect user-level lock name 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._'.]"]

Nov 02 08:22:43  [info] $backTrace = #0 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Core/Error.php(235): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: unknown error", -1, 16, (Array:2), "SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...")
#4 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-1, 16, (Array:2), "SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...")
#5 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -1, NULL, NULL, "SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...", "DB_Error", TRUE)
#6 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/DB/mysql.php(895): DB_common->raiseError(-1, NULL, NULL, NULL, "3057 ** Incorrect user-level lock name 'pantheon.1.cache.3a9e8c34426bc6dde01d...")
#7 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
#8 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...")
#9 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/DB/DataObject.php(2442): DB_common->query("SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...")
#10 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...")
#11 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Core/DAO.php(325): DB_DataObject->query("SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...")
#12 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Core/DAO.php(1234): CRM_Core_DAO->query("SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/mo...", TRUE)
#13 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Core/Lock.php(151): CRM_Core_DAO::singleValueQuery("SELECT GET_LOCK( %1, %2 )", (Array:2))
#14 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/Civi/Core/Lock/LockManager.php(84): CRM_Core_Lock->acquire(NULL)
#15 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Core/BAO/Cache.php(154): Civi\Core\Lock\LockManager->acquire("cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._")
#16 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Utils/Cache/SqlGroup.php(96): CRM_Core_BAO_Cache::setItem((Array:0), "3a9e8c34426bc6dde01d5581d9654dcf", "mapper/moduleFiles", NULL)
#17 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Extension/Mapper.php(321): CRM_Utils_Cache_SqlGroup->set("mapper/moduleFiles", (Array:0))
#18 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Core/PseudoConstant.php(1837): CRM_Extension_Mapper->getActiveModuleFiles(FALSE)
#19 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Utils/Hook.php(247): CRM_Core_PseudoConstant::getModuleExtensions()
#20 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Utils/Hook/DrupalBase.php(104): CRM_Utils_Hook->requireCiviModules((Array:0))
#21 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Utils/Hook/DrupalBase.php(83): CRM_Utils_Hook_DrupalBase->buildModuleList()
#22 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Utils/Hook.php(1043): CRM_Utils_Hook_DrupalBase->invoke(1, Object(CRM_Core_Config), NULL, NULL, NULL, NULL, NULL, "civicrm_config")
#23 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/CRM/Core/Config.php(257): CRM_Utils_Hook::config(Object(CRM_Core_Config))
#24 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/drupal/civicrm.module(220): CRM_Core_Config::singleton()
#25 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/civicrm/drupal/civicrm.module(862): civicrm_initialize()
#26 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/views/plugins/views_plugin_query_default.inc(1405): civicrm_views_query_alter(Object(view), Object(views_plugin_query_default))
#27 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/views/includes/view.inc(1049): views_plugin_query_default->alter(Object(view))
#28 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/views/plugins/views_plugin_display_page.inc(217): view->build()
#29 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/views/includes/view.inc(1345): views_plugin_display_page->execute()
#30 /Users/ken/Documents/SIA/site-upgrade/sites/all/modules/views/views.module(540): view->execute_display("page", (Array:0))
#31 [internal function](): views_page("frontpage", "page")
#32 /Users/ken/Documents/SIA/site-upgrade/includes/menu.inc(527): call_user_func_array("views_page", (Array:2))
#33 /Users/ken/Documents/SIA/site-upgrade/index.php(21): menu_execute_active_handler()
#34 {main}
  • Do you see any backtrace in CiviCRM log file (sites/default/files/civicrm/ConfigAndLog/<log_file>). If yes, can you paste the backtrace here ? Nov 2, 2015 at 5:32
  • Thanks @JitendraPurohit ! I'll paste the log here. Looks like it's having problems with locking. Nov 2, 2015 at 13:25
  • Entro a una pajina y me aparese esro de error Mar 22, 2018 at 14:20

4 Answers 4


Reviewing the stack trace you provided, the line [debug_info] => SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._', 3 ) [nativecode=3057 ** Incorrect user-level lock name 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._'.] is the important one.

I googled nativecode=3057 ** Incorrect user-level lock name and it reported to be an error added to MySQL in v5.7.

To the best of my knowledge, CiviCRM has not been tested w 5.7. You should revert your MySQL version back to an earlier version (5.5 is the most recent version tested with CiviCRM I think) and try again.

  • After reverting to MySQL 5.6, everything started to work fine. Nov 3, 2015 at 19:43
  • Glad you got it working! Nov 3, 2015 at 21:37
  • There are changes in 5.6 -> 5.7 Get_Lock() and some bugs: Nov 5, 2015 at 16:23
  • 1
    See:"MySQL 5.7.5 and later enforces a maximum length on lock names of 64 characters. Previously, no limit was enforced." I noticed the lock name is 72 characters so that is something to take a look at. Nov 5, 2015 at 16:41

Browser - From the browser, go to Administer > System Settings > Debugging and Error Handling and you can turn on Enable Debugging and Display Backtrace. That should provide you with more specific errors that you need to debug.

Also, per the help item on "Enable Bugging" you can do the following to any Civi URL for a stack trace:

Stack Trace - To display a stack trace listing at the top of a page, add &backtrace=1

Since you're working on your dev copy, you don't have to worry about your production environment being affected.

Drush - For drush, you can enable debugging with this command:

drush civicrm-enable-debug

Source: http://drushcommands.com/drush-6x/civicrm/civicrm-enable-debug

Database - If you are locked out of Civi (no pages displaying) and Drush is not an option, you can also enable Debugging and BackTrace if you have access to your database.

From the civicrm_settings table, find the lines with a group name of Developer Preferences and the name debug_enabled and backtrace. For the value of each line, change s:1:"0"; to s:1:"1"; and save. That will enable them.

  • That produces the same error, apparently it's dying before it has a chance to turn on debugging. Is there a way to do the same thing directly in the database? Oct 31, 2015 at 21:42
  • I've added another option for using the database only. Nov 1, 2015 at 2:50
  • The only Developer Preferences row I have is fatalErrorTemplate - so I presume I need to add rows with name='debug_enabled' and name='backtrace', but I'm not sure what values to use for the other fields. Nov 1, 2015 at 4:03
  • While trying to figure this out, I ended up just downloading PHPStorm and debugging there - MUCH better. I could step through in a debugger like a real person, though it did still keep dying with no stack trace eventually. Nov 3, 2015 at 5:50

Sorry for the late post here, but this tip might help someone going forward with this error.

I too was receiving this error on a fresh install of CiviCRM with WordPress. It was noted there were ajax errors. We guessed that the script was calling for more memory than the server had allotted. Memory allocation was increased and the error went away. It was that easy.

Hope this helps someone else with the same problem.


Based on the following line in the CiviCRM log file:

   [debug_info] => SELECT GET_LOCK( 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._', 3 ) [nativecode=3057 ** Incorrect user-level lock name 'pantheon.1.cache.3a9e8c34426bc6dde01d5581d9654dcf_mapper/moduleFiles._'.]

this appears to be an issue with Pantheon's database setup. I would submit a ticket with Pantheon support to see if they can resolve it.

  • Actually, I don't use Pantheon. The name of the database just happens to be "pantheon" as a holdover from when I was experimenting with using Pantheon. My environment is just a local server & database running on my Macbook. Nov 2, 2015 at 15:17
  • Did you copy the pantheon codebase/database to the local server instance? Pantheon does make some subtle changes to their installation to accommodate their business model which may trip you up if you move it elsewhere.
    – DaveD
    Nov 2, 2015 at 15:20
  • It also looks like the error message was added to MySQL 5.7 (meaning that is the version you are running I think). To the best of my knowledge, CiviCRM has not been tested w 5.7. You should revert your MySQL version back to 5.5 (the most recent version tested I think) and try again.
    – DaveD
    Nov 2, 2015 at 15:22
  • My hosting provider (DreamHost) updated to MySQL 5.6, which precipitated this testing, so I updated my local test environment (because of other incompatibilities I was having). I'll roll the test environment back to 5.6 and see if I can get that working. Nov 2, 2015 at 15:29
  • Regarding the Pantheon codebase - I don't think I should have any of their codebase in my environment, I update Drupal using the stock Drupal releases. Nov 2, 2015 at 15:30

Your Answer

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

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