1

System: WordPress 5.3.2, CiviCRM 5.20.2, PHP 7.1.33

Problem: Since 1/1/2020 at 12:00am, every time our cron job runs on the hour I get an email notification that says

DB Error: no such field Died during callApi

In looking at the error log (shown below), the error is in an UPDATE statement on the civicrm_status_pref table, saying that the is_active field doesn't exist. But it does:

Structure of civicrm_status_prefs

I am not getting any other errors. System Status says that I'm a little behind with the PHP version and CiviCRM (but the error has persisted through one civi update). All extensions are up to date. And as near as I can tell, everything in CiviCRM is working fine.

What am I missing? Why am I getting this error? Thanks!

Error Log:

Feb 17 16:00:02  [error] $Fatal Error Details = Array
    (
        [callback] => Array
            (
                [0] => CRM_Core_Error
                [1] => exceptionHandler
            )

        [code] => -19
        [message] => DB Error: no such field
        [mode] => 16
        [debug_info] => UPDATE  civicrm_status_pref  SET domain_id = 1 , name = 'checkLastCron' , ignore_severity = 0 , check_info = '1581987602' , is_active = 1   WHERE (  civicrm_status_pref.id = 1 )   [nativecode=1054 ** Unknown column 'is_active' in 'field list']
        [type] => DB_Error
        [user_info] => UPDATE  civicrm_status_pref  SET domain_id = 1 , name = 'checkLastCron' , ignore_severity = 0 , check_info = '1581987602' , is_active = 1   WHERE (  civicrm_status_pref.id = 1 )   [nativecode=1054 ** Unknown column 'is_active' in 'field list']
        [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="UPDATE  civicrm_status_pref  SET domain_id = 1 , name = 'checkLastCron' , ignore_severity = 0 , check_info = '1581987602' , is_active = 1   WHERE (  civicrm_status_pref.id = 1 )   [nativecode=1054 ** Unknown column 'is_active' in 'field list']"]
    )


    Feb 17 16:00:02  [debug] $backTrace = #0 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(921): CRM_Core_Error::backtrace("backTrace", TRUE)
    #1 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::exceptionHandler(Object(DB_Error))
    #2 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/packages/DB.php(987): PEAR_Error->__construct("DB Error: no such field", -19, 16, (Array:2), "UPDATE  civicrm_status_pref  SET domain_id = 1 , name = 'checkLastCron' , ign...")
    #3 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-19, 16, (Array:2), "UPDATE  civicrm_status_pref  SET domain_id = 1 , name = 'checkLastCron' , ign...")
    #4 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -19, 16, (Array:2), "UPDATE  civicrm_status_pref  SET domain_id = 1 , name = 'checkLastCron' , ign...", "DB_Error", TRUE)
    #5 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1920): PEAR->__call("raiseError", (Array:7))
    #6 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-19, NULL, NULL, "UPDATE  civicrm_status_pref  SET domain_id = 1 , name = 'checkLastCron' , ign...", "1054 ** Unknown column 'is_active' in 'field list'")
    #7 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
    #8 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1229): DB_mysqli->simpleQuery("UPDATE  civicrm_status_pref  SET domain_id = 1 , name = 'checkLastCron' , ign...")
    #9 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2416): DB_common->query("UPDATE  civicrm_status_pref  SET domain_id = 1 , name = 'checkLastCron' , ign...")
    #10 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(1318): DB_DataObject->_query("UPDATE  civicrm_status_pref  SET domain_id = 1 , name = 'checkLastCron' , ign...")
    #11 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(560): DB_DataObject->update()
    #12 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/StatusPreference.php(86): CRM_Core_DAO->save()
    #13 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/CRM/Core/JobManager.php(93): CRM_Core_BAO_StatusPreference::create((Array:3))
    #14 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/api/v3/Job.php(134): CRM_Core_JobManager->execute(FALSE)
    #15 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/Civi/API/Provider/MagicFunctionProvider.php(101): civicrm_api3_job_execute((Array:2))
    #16 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(168): Civi\API\Provider\MagicFunctionProvider->invoke((Array:9))
    #17 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(99): Civi\API\Kernel->runRequest((Array:9))
    #18 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/api/api.php(23): Civi\API\Kernel->runSafe("Job", "execute", (Array:2), NULL)
    #19 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/bin/cli.class.php(122): civicrm_api("Job", "execute", (Array:2))
    #20 /home/thefolks/public_html/wp-content/plugins/civicrm/civicrm/bin/cli.php(32): civicrm_cli->callApi()
    #21 {main}
2

DO you have DB logging turned on? If so turn it off & back on again - the log_civicrm_status_pref table might be missing the field

| improve this answer | |
  • I do indeed have logging turned on. Turning it off and back on didn't do anything, but manually adding the field to log_civicrm_status_pref seems to have done it. Thanks! – RiverRunner Feb 20 at 6:04
1

I had the same, the table was missing, I added it using

https://gist.github.com/xurizaemon/ac3d5bbc90712348d79a8d56bdd0b5ca

CREATE TABLE `civicrm_status_pref` (


     `id` int unsigned NOT NULL AUTO_INCREMENT  COMMENT 'Unique Status Preference ID',
     `domain_id` int unsigned NOT NULL   COMMENT 'Which Domain is this Status Preference for',
     `name` varchar(255) NOT NULL   COMMENT 'Name of the status check this preference references.',
     `hush_until` date   DEFAULT NULL COMMENT 'expires ignore_severity.  NULL never hushes.',
     `ignore_severity` int unsigned   DEFAULT 1 COMMENT 'Hush messages up to and including this severity.',
     `prefs` varchar(255)    COMMENT 'These settings are per-check, and can\'t be compared across checks.',
     `check_info` varchar(255)    COMMENT 'These values are per-check, and can\'t be compared across checks.' 
,
        PRIMARY KEY (`id`)
 
    ,     INDEX `UI_status_pref_name`(
        name
  )
  
,          CONSTRAINT FK_civicrm_status_pref_domain_id FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain`(`id`)   
)  ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci  ;

and disabling the foreign key check.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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