Answers.Body: <p>Probably it's existance is cached - try truncating civicrm_cache and  / or calling the System.flush api</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-10T07:42:54.750Z
Answers.Text: I truncated civicrm_cache. BUt that didn't help
Answers.UserDisplayName: Pancharatna dasa
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-10T22:27:33.187Z
Answers.Text: 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
Answers.UserDisplayName: user4278
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-10T04:12:04.730Z
Answers.LastActivityDate: 2018-04-10T04:12:04.730Z
Answers.UserDisplayName: user4278
Body: <p>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.</p>
  
  <p>I then got this error when I tried to do anything in Civi:</p>
  
  <pre><code>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).
  </code></pre>
  
  <p>I tried commenting out the offending code in api.php, which got me past the error, but produced a whole bunch more warnings.</p>
  
  <p>I saw in the table - <code>civicrm_custom_field</code>, that the record for the field that I tried to delete was still there. I manually deleted it but that did not help.</p>
  
  <p>IN this situation I can;t get into CiviCRM at all to turn on backtrace or any other logging.</p>
  
  <p>Really and truly stuck. Any help would be appreciated.</p>
  
Tags: <custom-fields><api><error>
Title: CiviCRM_API3_Exception: Expected one CustomField but found 0 in civicrm_api3() (line 45 of sites/all/modules/civicrm/api/api.php)
ThreadText: # CiviCRM_API3_Exception: Expected one CustomField but found 0 in civicrm_api3() (line 45 of sites/all/modules/civicrm/api/api.php)
  
  (Asked by: username_0 on 2018-04-09)
  
  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.
  
  **Tags:** custom-fields, api, error
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-04-10. Score: 1
  
  Probably it's existance is cached - try truncating civicrm\_cache and / or calling the System.flush api
  
  > **Comments:**
  > **username_0**: I truncated civicrm_cache. BUt that didn't help  
  > **username_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  
  
  ---
  
  