Answers.Body: <p>The issue was that a row in the <code>end_date</code> column of the <code>civicrm_relationship</code> table had an incorrect date value of '0000-00-00' when it should have been NULL.</p>
  <p>I tracked this by watching the mysql log output where I found the sql query for rebuilding the relationship cache table. Running the query in phpmyadmin notified me of the error.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-04-27T21:54:07.463Z
Answers.LastActivityDate: 2024-04-27T21:54:07.463Z
Answers.UserDisplayName: macMark
Body: <p>I'm getting a &quot;Missing Relationship Cache Data&quot; warning on the CiviCRM status page after updating from 5.67.3 to 5.72.2. Clicking the button to rebuild cache shows a spinner and fails to rebuild the cache. I tried running the command</p>
  <pre><code>cv api4 RelationshipCache.rebuild
  </code></pre>
  <p>and also</p>
  <pre><code>cv ev 'CRM_Contact_BAO_RelationshipCache::rebuild();'
  </code></pre>
  <p>but it just outputs &quot;In Error.php line 971: DB Error: unknown error&quot;</p>
  <p>How do I figure out where the error is, and get the cache rebuild to work? The status warning says Expected 52684 records, and that it found 0 in cache. In addition, now the relationship tab in contacts doesn't show any relationships when previously there used to be.</p>
  <p>Civi is running on Drupal 7.100 with php 8.1.28. cv version is 0.3.48.</p>
  <p>I checked logs in the ConfigAndLog folder, Drupal logs, syslog, php-fpm, nginx logs and get no information regarding the error.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-04-26T18:14:08.363Z
Comments.Text: check civicrm log for more details about the db error https://civicrm.stackexchange.com/questions/15931/where-are-the-configandlog-and-templates-c-directories
Comments.UserDisplayName: Pradeep Nayak
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-04-26T19:06:10.453Z
Comments.Text: Civi log is not adding any new messages when I run the cv commands.
Comments.UserDisplayName: macMark
Tags: <database><relationships><cache><cv>
Title: Missing Relationship Cache Data fails to rebuild cache with DB error
ThreadText: # Missing Relationship Cache Data fails to rebuild cache with DB error
  
  (Asked by: username_0 on 2024-04-26)
  
  I'm getting a "Missing Relationship Cache Data" warning on the CiviCRM status page after updating from 5.67.3 to 5.72.2. Clicking the button to rebuild cache shows a spinner and fails to rebuild the cache. I tried running the command
  cv api4 RelationshipCache.rebuild
  
  and also
  cv ev 'CRM_Contact_BAO_RelationshipCache::rebuild();'
  
  but it just outputs "In Error.php line 971: DB Error: unknown error"
  How do I figure out where the error is, and get the cache rebuild to work? The status warning says Expected 52684 records, and that it found 0 in cache. In addition, now the relationship tab in contacts doesn't show any relationships when previously there used to be.
  Civi is running on Drupal 7.100 with php 8.1.28. cv version is 0.3.48.
  I checked logs in the ConfigAndLog folder, Drupal logs, syslog, php-fpm, nginx logs and get no information regarding the error.
  
  **Tags:** database, relationships, cache, cv
  
  > **Comments:**
  > **username_1**: check civicrm log for more details about the db error https://civicrm.stackexchange.com/questions/15931/where-are-the-configandlog-and-templates-c-directories  
  > **username_0**: Civi log is not adding any new messages when I run the cv commands.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2024-04-27. Score: 2 | Accepted answer
  
  The issue was that a row in the `end_date` column of the `civicrm_relationship` table had an incorrect date value of '0000-00-00' when it should have been NULL.
  
  I tracked this by watching the mysql log output where I found the sql query for rebuilding the relationship cache table. Running the query in phpmyadmin notified me of the error.
  
  
  ---
  
  