On several sites (all currently running CiviCRM 5.58.1 but all having existed much longer) I have found contributions which have no line items -- that is, rows in civicrm_contribution that have no corresponding rows in civicrm_line_item.

enter image description here

Could this in any way be normal?

I'm unable to reproduce such a situation at will, except by manually deleting rows in civicrm_line_item via API or SQL. It seems any contribution record will, by design, have at least one line_item, even if using a quick-config contribution instead of a visible price set, or if manually creating even a zero-dollar contribution in the back-end.

This situation leads to a fatal error ("Return value of CRM_Financial_BAO_Order::getPriceSetID() must be of the type int, null returned") when attempting to generate a PDF invoice with "Download Invoice" for the given contribution, apparently on the assumption that this situation is not expected by core code.

Question: Is there any reasonable way -- i.e. not a bug -- that CiviCRM could be creating this situation? If so, I can explore a bug report on the above-mentioned fatal error. If not, I'll need to investigate further how this situation is arising on various sites. (And if you want to check on your own sites and comment on your findings, I'm naturally curious about that too.)

For reference, this query identifies the number of contributions having no line items:

SELECT count(*)
civicrm_contribution ctr
left join civicrm_line_item li on li.contribution_id = ctr.id
where li.id is null;
  • I have seen this before but can't remember exactly - possibly on a site with webform (drupal 7) but where it was missing the legacy transact extension?
    – Demerit
    May 5, 2023 at 23:21
  • We have a handful (about 0.06% of all contributions), only 4 in the last 5 years. A number of them are $0 contributions from price set event registrations, but there are membership sign ups and other transactions too. Looks like something that happens occasionally due to some rare bug to me.
    – Lars SG
    May 6, 2023 at 15:51
  • I recollect a few of these - a quick search in our ticket system only came up with a case where "membershiprenewalcontrol extension" was involved (we then fixed it) - but does potentially point at extensions as also a source these
    – petednz - fuzion
    May 7, 2023 at 20:00

1 Answer 1


Consensus seems to be:

  1. This is not normal behavior.
  2. There are no known steps to repro, nor a known cause.

I've filed a bug report at https://lab.civicrm.org/dev/core/-/issues/4318 ; hopefully others who encounter this issue can add useful information there. (Would be great if we can find some actual steps to repro at will!)

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.