I was cleaning up some extra custom fields in our DB. ONe of these , though it was disabled did not stop displaying in the contact profile. So I clicked to delete it.

I then got this error when I tried to do anything in Civi:

CiviCRM_API3_Exception: Expected one CustomField but found 0 in civicrm_api3() (line 45 of /var/www/crm/sites/all/modules/civicrm/api/api.php).

I tried commenting out the offending code in api.php, which got me past the error, but produced a whole bunch more warnings.

I saw in the table - civicrm_custom_field, that the record for the field that I tried to delete was still there. I manually deleted it but that did not help.

IN this situation I can;t get into CiviCRM at all to turn on backtrace or any other logging.

Really and truly stuck. Any help would be appreciated.

1 Answer 1


Probably it's existance is cached - try truncating civicrm_cache and / or calling the System.flush api

  • I truncated civicrm_cache. BUt that didn't help Apr 10, 2018 at 7:42
  • 1
    it's worth jumping into chat.civicrm.org when you are about because this sort of issue is usually better with a bit more back & forth. There are probably backtraces in your ConfigAndLog directory - for drupal you would usually find them in sites/default/files/civicrm/ConfigAndLog
    – user4278
    Apr 10, 2018 at 22:27

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.