We're using D7 / Civi 4.6.20, attempted to upgrade to 4.6.21 following the Civi upgrade documentation. The upgrade errors out with this error:

Exception: "A fatal error was triggered: sqlfile - 4.6.21.mysql not found."

I tried reloading my pre-upgrade database and repeating, but got the same error.


#0 SITEROOT/sites/all/modules/civicrm/CRM/Upgrade/Form.php(432): CRM_Core_Error::fatal("sqlfile - 4.6.21.mysql not found.")
#1 SITEROOT/sites/all/modules/civicrm/CRM/Upgrade/Incremental/php/FourSix.php(86): CRM_Upgrade_Form->processSQL("4.6.21")
#2 [internal function](): CRM_Upgrade_Incremental_php_FourSix::task_4_6_x_runSql(Object(CRM_Queue_TaskContext), "4.6.21")
#3 SITEROOT/sites/all/modules/civicrm/CRM/Queue/Task.php(88): call_user_func_array((Array:2), (Array:2))
#4 SITEROOT/sites/all/modules/civicrm/CRM/Queue/Runner.php(214): CRM_Queue_Task->run(Object(CRM_Queue_TaskContext))
#5 SITEROOT/sites/all/modules/civicrm/CRM/Queue/Page/AJAX.php(52): CRM_Queue_Runner->runNext(TRUE)
#6 SITEROOT/sites/all/modules/civicrm/CRM/Queue/ErrorPolicy.php(106): {closure}()
#7 SITEROOT/sites/all/modules/civicrm/CRM/Queue/Page/AJAX.php(54): CRM_Queue_ErrorPolicy->call(Object(Closure))
#8 [internal function](): CRM_Queue_Page_AJAX::runNext()
#9 SITEROOT/sites/all/modules/civicrm/CRM/Core/Invoke.php(278): call_user_func((Array:2))
#10 SITEROOT/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:13))
#11 SITEROOT/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:5))
#12 SITEROOT/sites/all/modules/civicrm/drupal/civicrm.module(482): CRM_Core_Invoke::invoke((Array:5))
#13 [internal function](): civicrm_invoke("upgrade", "queue", "ajax", "runNext")
#14 SITEROOT/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:4))
#15 SITEROOT/index.php(21): menu_execute_active_handler()
#16 {main}

I searched and couldn't find a file called 4.6.21.mysql but I did find /sites/all/modules/civicrm/CRM/Upgrade/Incremental/sql/4.6.21.mysql.tpl.

Any advice? Thanks in advance!

2 Answers 2


I would recommend you grab this file https://github.com/civicrm/civicrm-core/blob/4.6/CRM/Upgrade/Incremental/sql/4.6.21.mysql.tpl and then save it into same path within your civicrm dir i.e. in CRM/Upgrade/Incremental/sql/

Once you have done that re-load your pre-upgrade database and run the upgrade again.

Should be all good then


Looking at the source code for the processSQL function in CRM_Upgrade_Form, I can see that it works like this:

  • Given a revision (in this case, 4.6.21), it looks for Incremental/sql/4.6.21.mysql.tpl.
  • If that file is NOT found, it looks for Incremental/sql/4.6.21.mysql.
  • If it finds neither, it returns the error you saw.

Here's what you can try: * Please check the file owner/permissions of this file to ensure it can be read by your web server user. * Ensure it's looking for the right file in the right place. Try putting this line into CRM/Upgrade/Form.php at line 426:

CRM_Core_Error::debug_var("tplFile", $tplFile);

Then, on upgrade, watch your debug logs (usually at <drupalroot>/sites/default/civicrm/ConfigAndLog) to see the value of tplFile. Please update your question if it seems to be looking for the wrong file.

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.