Call to civicrm_api3_create_error from civicrm/Civi/API/Kernel.php fails
An overnight geocode Scheduled Job started generating an error on 2023-11-03 because the Parameters had a blank line at the end. I'd updated to CiviCRM 5.67.0 the day before.
Parameters raw (from db settings):
geocoding=1
parse=0
Parameters parsed (and passed to API method): a:0:{}
When previously the parameters passed to the API a:3:{s:7:"version";i:3;s:9:"geocoding";s:1:"1";s:5:"parse";s:1:"0";}
I fixed that problem by removing the blank line.
However, the error was being reported through civicrm/Civi/API/Kernel.php line 407 it seems, ie here: https://github.com/civicrm/civicrm-core/blob/master/Civi/API/Kernel.php#L407
This threw an exception as shown below.
I fixed that problem adding this line before
require_once "api/v3/utils.php";
Hope this helps, Chris
When seeking help with this issue, you may be asked for some of the following information:
WordPress version 6.3.2
Active theme: Avada (version 7.11.2)
Current plugin: CiviCRM (version 5.67.0) PHP version 8.1.25
Error Details
=============
An error of type E_ERROR was caused in line 407 of the file /var/.../wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php. Error message: Uncaught Error: Call to undefined function civicrm_api3_create_error() in /var/.../wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php:407
Stack trace:
#0 /var/.../wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(348): Civi\API\Kernel->createError()
#1 /var/.../wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(88): Civi\API\Kernel->formatApiException()
#2 /var/.../wp-content/plugins/civicrm/civicrm/api/api.php(28): Civi\API\Kernel->runSafe()
#3 /var/.../wp-content/plugins/civicrm/civicrm/CRM/Core/JobManager.php(125): civicrm_api()
#4 /var/.../wp-content/plugins/civicrm/civicrm/CRM/Core/JobManager.php(92): CRM_Core_JobManager->executeJob()
#5 /var/.../wp-content/plugins/civicrm/civicrm/CRM/Admin/Form/Job.php(218): CRM_Core_JobManager->executeJobById()
#6 /var/.../wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(614): CRM_Admin_Form_Job->postProcess()
#7 /var/.../wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Submit.php(56): CRM_Core_Form->mainProcess()
#8 /var/.../wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Submit->perform()
#9 /var/.../wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle()
#10 /var/.../wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(355): HTML_QuickForm_Page->handle()
#11 /var/.../wp-content/plugins/civicrm/civicrm/CRM/Core/Page/Basic.php(364): CRM_Core_Controller->run()
#12 /var/.../wp-content/plugins/civicrm/civicrm/CRM/Core/Page/Basic.php(170): CRM_Core_Page_Basic->edit()
#13 /var/.../wp-content/plugins/civicrm/civicrm/CRM/Admin/Page/Job.php(140): CRM_Core_Page_Basic->run()
#14 /var/.../wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(322): CRM_Admin_Page_Job->run()
#15 /var/.../wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem()
#16 /var/.../wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke()
#17 /var/.../wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke()
#18 /var/.../wp-includes/class-wp-hook.php(310): CiviCRM_For_WordPress->invoke()
#19 /var/.../wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
#20 /var/.../wp-includes/plugin.php(517): WP_Hook->do_action()
#21 /var/.../wp-admin/admin.php(259): do_action()
#22 {main}