Answers.Body: <p>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</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-24T13:41:34.123Z
Answers.Text: 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.
Answers.UserDisplayName: Angela
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-24T13:51:14.953Z
Answers.Text: I edited my question to reflect that your hint was helpful in finding the overall solution.  Thank you.
Answers.UserDisplayName: Angela
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-24T20:05:11.410Z
Answers.Text: 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?
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-25T13:16:18.140Z
Answers.Text: 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.
Answers.UserDisplayName: Angela
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-13T20:24:21.810Z
Answers.LastActivityDate: 2015-07-13T20:24:21.810Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>I would recommend looking in two other places:</p>
  
  <ol>
  <li>The CiviCRM error log. This is to be found (for Drupal) in sites/default/files/civicrm/ConfigAndLog/CiviCRM.(long number).log </li>
  <li>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. </li>
  </ol>
  
  <p>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. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-24T13:39:47.047Z
Answers.Text: Thanks.  Unfortunately, neither of these places yielded additional info that was helpful, but you did answer my question!
Answers.UserDisplayName: Angela
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-13T15:10:35.127Z
Answers.LastActivityDate: 2015-07-13T15:10:35.127Z
Answers.UserDisplayName: TheBarnacle
Body: <p>I have discovered that I have had the "Disable expired relationships" job producing the following error.  Triggering the job manually yields the same result.</p>
  
  <p>How can I find out more information about what is tripping up the system so that I can rectify the problem?</p>
  
  <p>This is a Drupal implementation.</p>
  
  <blockquote>
    <p>2015-07-12 16:20:46    Disable expired relationships<br>
    0
    Summary
    Finished execution of Disable expired relationships with result: Failure, Error message: Relationship is not valid
    Details</p>
    
    <p>Parameters parsed (and passed to API method): 
    a:1:{s:7:"version";i:3;}</p>
    
    <p>Full message: 
    Finished execution of Disable expired relationships with result: Failure, Error message: Relationship is not valid</p>
  </blockquote>
  
  <p>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:</p>
  
  <pre><code>
  SELECT
    RELATIONSHIP.id as relationship_id, 
    RELATIONSHIP.contact_id_a, 
    RELATIONSHIP.contact_id_b, 
    RELATIONSHIP.relationship_type_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
  </code></pre>
  
  <p>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.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-13T13:58:14.883Z
Comments.Text: Is that error coming from the CiviCRM logs?
Comments.UserDisplayName: TheBarnacle
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-13T14:57:50.350Z
Comments.Text: This is what is displayed at /civicrm/admin/joblog?jid=18&reset=1
Comments.UserDisplayName: Angela
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-14T20:58:45.813Z
Comments.Text: that query saved me a ton of grief, thank you
Comments.UserDisplayName: ericG
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-29T08:13:14.203Z
Comments.Text: 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!
Comments.UserDisplayName: Betty Dolfing
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-05-31T16:57:38.247Z
Comments.Text: That query is the answer! Thank you!
Comments.UserDisplayName: guyiac
Tags: <cron-job>
Title: How can I get more details about a Scheduled Jobs failure?
ThreadText: # How can I get more details about a Scheduled Jobs failure?
  
  (Asked by: username_0 on 2015-07-13)
  
  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:
  
  ```
  
  SELECT
    RELATIONSHIP.id as relationship_id, 
    RELATIONSHIP.contact_id_a, 
    RELATIONSHIP.contact_id_b, 
    RELATIONSHIP.relationship_type_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.
  
  **Tags:** cron-job
  
  > **Comments:**
  > **username_1**: Is that error coming from the CiviCRM logs?  
  > **username_0**: This is what is displayed at /civicrm/admin/joblog?jid=18&reset=1  
  > **username_2**: that query saved me a ton of grief, thank you  
  > **username_3**: 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!  
  > **username_4**: That query is the answer! Thank you!  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-07-13. Score: 3 | Accepted answer
  
  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.
  
  > **Comments:**
  > **username_0**: Thanks.  Unfortunately, neither of these places yielded additional info that was helpful, but you did answer my question!  
  
  ---
  
  ### Answer by username_5 on 2015-07-13. Score: 2
  
  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
  
  > **Comments:**
  > **username_0**: 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.  
  > **username_0**: I edited my question to reflect that your hint was helpful in finding the overall solution.  Thank you.  
  > **username_5**: 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?  
  > **username_0**: 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.  
  
  ---
  
  