I have discovered that I have had the "Disable expired relationships" job producing the following error. Triggering the job manually yields the same result.

How can I find out more information about what is tripping up the system so that I can rectify the problem?

This is a Drupal implementation.

2015-07-12 16:20:46 Disable expired relationships
0 Summary Finished execution of Disable expired relationships with result: Failure, Error message: Relationship is not valid Details

Parameters parsed (and passed to API method): a:1:{s:7:"version";i:3;}

Full message: Finished execution of Disable expired relationships with result: Failure, Error message: Relationship is not valid

EDIT: While I had hoped that jumping into error logs would yield more information, the output of the following SQL statement was helpful to jump in and fix some errant data:

  RELATIONSHIP.id as relationship_id, 
  CONTACT1.contact_type AS contact_type_a,
  RELTYPE.contact_type_a as expected_type_a,
  CONTACT1.contact_sub_type as contact_subtype_a,
  RELTYPE.contact_sub_type_a as expected_sub_type_a, 
  CONTACT2.contact_type AS contact_type_b,
  RELTYPE.contact_type_b as expected_type_b,
  CONTACT2.contact_sub_type as contact_subtype_b,
  RELTYPE.contact_sub_type_b as expected_sub_type_b
FROM civicrm_relationship AS RELATIONSHIP
LEFT JOIN civicrm_contact AS CONTACT1
  ON RELATIONSHIP.contact_id_A = CONTACT1.id
LEFT JOIN civicrm_contact AS CONTACT2
  ON RELATIONSHIP.contact_id_B = CONTACT2.id
LEFT JOIN civicrm_relationship_type as RELTYPE
  ON RELATIONSHIP.relationship_type_id = RELTYPE.id

I took the export of this into Excel and used the AND function to compare what contact types/subtypes were expected for each contact and what was really sitting in there. When I fixed the data, the cron job ran successfully.

  • Is that error coming from the CiviCRM logs? Commented Jul 13, 2015 at 13:58
  • This is what is displayed at /civicrm/admin/joblog?jid=18&reset=1
    – Angela
    Commented Jul 13, 2015 at 14:57
  • 1
    that query saved me a ton of grief, thank you
    – ericG
    Commented Feb 14, 2018 at 20:58
  • 1
    That query helped me enourmously. Thanks! Exported as CSV, compared column where it said 'NULL' with column 'Expected Type' and then changed those 3 contacts in CiviCRM to the correct Contact type. Then ran the scheduled job again and Bingo! Commented Oct 29, 2021 at 8:13
  • That query is the answer! Thank you!
    – guyiac
    Commented May 31, 2023 at 16:57

2 Answers 2


I would recommend looking in two other places:

  1. The CiviCRM error log. This is to be found (for Drupal) in sites/default/files/civicrm/ConfigAndLog/CiviCRM.(long number).log
  2. The PHP error logs. This is different for each server / Control Panel so I'm afraid I can't give more specific directions than that.

Make sure you find the place in the logs which matches the time that you triggered the job, to save you trawling through many lines of text. I would suggest you trigger the job one more time, take note of when you did it, and then look up what happened in those two places at that time.

  • Thanks. Unfortunately, neither of these places yielded additional info that was helpful, but you did answer my question!
    – Angela
    Commented Jul 24, 2015 at 13:39

The message is saying "Relationship is not valid:" you may need to trawl through sql and check you don't have relationship using an incorrect Contact Type

  • I was really hoping to get some additional error info, like a record number where the job was failing, but that didn't happen. Getting deep into the data itself did help, though.
    – Angela
    Commented Jul 24, 2015 at 13:41
  • I edited my question to reflect that your hint was helpful in finding the overall solution. Thank you.
    – Angela
    Commented Jul 24, 2015 at 13:51
  • OK, so was the problem that a Relationship of a type that should be between Contact Type X and Contact Type Y had ended up connecting Contacts with Type X and Type Z or somesuch? I.e did you already have the Relationship Type and then changed the Contact Type of one of the two contacts?
    – petednz - fuzion
    Commented Jul 24, 2015 at 20:05
  • 1st question: exactly. 2nd question: I don't think that's how it happened. It looks like some staff opened up Cases for Household contacts, where the Roles for the Case were expecting Individuals. Cases had been deleted, but Relationships stayed. Dates were from last year-- uncertain if it had to do with timing of configuration changes, improvements that were made to CiviCase, or some combination thereof. There were also Relationships of an Individual to an incorrect Organization subtype that came in through an import. Again, unfortunately uncertain of the order of operations there.
    – Angela
    Commented Jul 25, 2015 at 13:16

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.