To reproduce the error: 1. open Payable Aging business report 2. click on the amount link for one of the payables On 2 out of the 3 payables, I get the following exception: ``` Report error An error occurred while running the report. 16 (apply-smob/1 #<catch-closure 7f283c2e55c0>) In c-interface.scm: 24:4 15 (gnc:call-with-error-handling _ _) In ice-9/boot-9.scm: 829:9 14 (catch _ _ #<procedure 7f27d83f7740 at c-interface.scm…> …) In c-interface.scm: 29:37 13 (_) In unknown file: 12 (eval-string "(gnc:report-run 2)" #<undefined>) In ice-9/boot-9.scm: 2312:4 11 (save-module-excursion _) In ice-9/eval-string.scm: 38:6 10 (read-and-eval #<input: string 7f27d83d8070> #:lang _) In report-core.scm: 689:4 9 (gnc:report-run _) In c-interface.scm: 66:2 8 (gnc:backtrace-if-exception _ . _) 24:4 7 (gnc:call-with-error-handling _ _) In ice-9/boot-9.scm: 829:9 6 (catch _ _ #<procedure 7f27d83f7560 at c-interface.scm…> …) In c-interface.scm: 28:40 5 (_) In report-core.scm: 691:29 4 (_) 673:25 3 (gnc:report-render-html #<<report> type: "08ae9c2e884b…> …) In standard/new-owner-report.scm: 1082:14 2 (reg-renderer _ _) In srfi/srfi-1.scm: 640:9 1 (for-each #<procedure 7f27d83eea20 at standard/new-own…> …) In standard/new-owner-report.scm: 745:17 0 (add-owner-table #<<html-table> col-headers: #f row-he…> …) In procedure module-lookup: Unbound variable: txn ``` It's probably bad data, but I could use some help figuring out where that bad data is.
Please attach the https://wiki.gnucash.org/wiki/Tracefile
Any idea where that might be when running in `flatpak`? It's not in /tmp, /var/tmp, and setting `--logto` on the command line doesn't work.
Created attachment 373845 [details] gnucash.trace output of flatpak run org.gnucash.GnuCash/x86_64/stable --debug --logto /dev/stdout 2>&1 | tee gnucash.trace
745:17 doesn't look buggy to me in 4.1. In any case the bad data being handled in this section is: the transaction type says invoice, but there is no associated invoice, nor lot. I'm not sure how you'd have this type of transaction.
From using gnucash for multiple years and since version 2 point whatever, no doubt. Any idea how to fix it? How can I locate a transaction of type invoice, with no invoice attached? Something I can search for in the raw XML file, maybe?
If you're confident modifying new-owner-report.scm then add this line marked '+' -- it will log the txn being processed, and the last one will be the difficult one. Having said that I hadn't tested this report exhaustively with Employees and will get back if I find bug. modified gnucash/report/reports/standard/new-owner-report.scm @@ -711,20 +711,22 @@ (let lp ((printed? #f) (odd-row? #t) (splits splits) (total 0) (debit 0) (credit 0) (tax 0) (sale 0)) + (if (pair? splits) (gnc:pk (xaccSplitGetParent (car splits)))) + (cond ((null? splits) ;;Balance row may not have been added if all transactions were before ;;start-date (and no other rows would be added either) so add it now (when (and (not printed?) (bal-col used-columns) (not (zero? total))) (add-balance-row odd-row? total)) (print-totals total debit credit tax sale) (gnc:html-table-set-style! table "table"
Or, for a more comprehensive logging: modified gnucash/report/reports/standard/new-owner-report.scm @@ -718,6 +718,14 @@ (tax 0) (sale 0)) + (when (pair? splits) + (let* ((txn (xaccSplitGetParent (car splits))) + (invoice (gncInvoiceGetInvoiceFromTxn txn))) + (newline) + (gnc:pk txn) + (gnc:pk invoice) + (gnc:pk (gncInvoiceGetPostedLot invoice)))) + (cond ((null? splits)
Thank you. I hacked out the transactions it was failing on and was able to get the report to show again. For one of the employees, it was one single transaction. The only thing that changed was type I to P, and the memo field (and the reconcile state, which I don't care about). The lot did not change. Strange.
Please feel free to paste the offending transaction - XML snippet should be fine; you can hide the amounts & description. I'll try strengthen the report.
<gnc:transaction version="2.0.0"> <trn:id type="guid">75e410d58a995b248e606ef53919b250</trn:id> <trn:currency> <cmdty:space>CURRENCY</cmdty:space> <cmdty:id>USD</cmdty:id> </trn:currency> <trn:date-posted> <ts:date>2018-02-16 10:59:00 +0000</ts:date> </trn:date-posted> <trn:date-entered> <ts:date>2018-02-16 14:04:58 +0000</ts:date> </trn:date-entered> <trn:description>XXXXXXXXXXXX</trn:description> <trn:slots> <slot> <slot:key>trans-txn-type</slot:key> <slot:value type="string">I</slot:value> </slot> </trn:slots> <trn:splits> <trn:split> <split:id type="guid">faef450db67e01df90a9952b5db0ccbf</split:id> <split:action>Payment</split:action> <split:reconciled-state>y</split:reconciled-state> <split:reconcile-date> <ts:date>2018-02-20 04:59:59 +0000</ts:date> </split:reconcile-date> <split:value>5000/100</split:value> <split:quantity>5000/100</split:quantity> <split:account type="guid">2580b90da4442ca2c40b391d9b621fea</split:account> <split:lot type="guid">746fe1ef99dec4eec97151ac69ea2b1d</split:lot> </trn:split> <trn:split> <split:id type="guid">268ed8efdd093f91be7b77dca9beb43b</split:id> <split:action>Payment</split:action> <split:reconciled-state>y</split:reconciled-state> <split:reconcile-date> <ts:date>2018-03-01 04:59:59 +0000</ts:date> </split:reconcile-date> <split:value>-5000/100</split:value> <split:quantity>-5000/100</split:quantity> <split:account type="guid">c935b36e9d2beb5caecca2ede730703a</split:account> </trn:split> </trn:splits> </gnc:transaction> The following change resulted in a working report for the employee: diff --git a/exports/ussr.gnucash b/exports/ussr.gnucash index 6b8a189..62eea94 100644 --- a/exports/ussr.gnucash +++ b/exports/ussr.gnucash @@ -175,7 +175,7 @@ Glenville, NY 12302</slot:value> <gnc:count-data cd:type="gnc:GncBillTerm">4</gnc:count-data> <gnc:count-data cd:type="gnc:GncCustomer">24</gnc:count-data> <gnc:count-data cd:type="gnc:GncEmployee">8</gnc:count-data> -<gnc:count-data cd:type="gnc:GncEntry">4421</gnc:count-data> +<gnc:count-data cd:type="gnc:GncEntry">4414</gnc:count-data> <gnc:count-data cd:type="gnc:GncInvoice">941</gnc:count-data> <gnc:count-data cd:type="gnc:GncJob">28</gnc:count-data> <gnc:count-data cd:type="gnc:GncVendor">1</gnc:count-data> @@ -19791,44 +19791,46 @@ Glenville, NY 12302</slot:value> </trn:splits> </gnc:transaction> <gnc:transaction version="2.0.0"> - <trn:id type="guid">75e410d58a995b248e606ef53919b250</trn:id> + <trn:id type="guid">21282d288fe14f638bd3e964bdbca03e</trn:id> <trn:currency> <cmdty:space>CURRENCY</cmdty:space> <cmdty:id>USD</cmdty:id> </trn:currency> + <trn:num>000005</trn:num> <trn:date-posted> <ts:date>2018-02-16 10:59:00 +0000</ts:date> </trn:date-posted> <trn:date-entered> - <ts:date>2018-02-16 14:04:58 +0000</ts:date> + <ts:date>2020-08-26 02:35:23 +0000</ts:date> </trn:date-entered> <trn:description>XXXXXXXXXXXXXXXX</trn:description> <trn:slots> + <slot> + <slot:key>date-posted</slot:key> + <slot:value type="gdate"> + <gdate>2018-02-16</gdate> + </slot:value> + </slot> <slot> <slot:key>trans-txn-type</slot:key> - <slot:value type="string">I</slot:value> + <slot:value type="string">P</slot:value> </slot> </trn:slots> <trn:splits> <trn:split> - <split:id type="guid">faef450db67e01df90a9952b5db0ccbf</split:id> + <split:id type="guid">48a11aab9b454f9e8a569ba209170fc0</split:id> + <split:memo>NEWMEMOXXXXXX</split:memo> <split:action>Payment</split:action> - <split:reconciled-state>y</split:reconciled-state> - <split:reconcile-date> - <ts:date>2018-02-20 04:59:59 +0000</ts:date> - </split:reconcile-date> + <split:reconciled-state>n</split:reconciled-state> <split:value>5000/100</split:value> <split:quantity>5000/100</split:quantity> <split:account type="guid">2580b90da4442ca2c40b391d9b621fea</split:account> <split:lot type="guid">746fe1ef99dec4eec97151ac69ea2b1d</split:lot> </trn:split> <trn:split> - <split:id type="guid">268ed8efdd093f91be7b77dca9beb43b</split:id> + <split:id type="guid">46b7e94dc9f449978a69c2dd94c3c525</split:id> <split:action>Payment</split:action> - <split:reconciled-state>y</split:reconciled-state> - <split:reconcile-date> - <ts:date>2018-03-01 04:59:59 +0000</ts:date> - </split:reconcile-date> + <split:reconciled-state>n</split:reconciled-state> <split:value>-5000/100</split:value> <split:quantity>-5000/100</split:quantity> <split:account type="guid">c935b36e9d2beb5caecca2ede730703a</split:account>
man I wish I had an excuse to re-learn lisp and dig into this... :)
Thank you I found the cause for the report crash. I'll make sure the report will dump the offending split as a full fix.
Try this patch: modified gnucash/report/reports/standard/new-owner-report.scm @@ -536,6 +536,16 @@ ((simple) '((#f))) ((detailed) (list (make-link-blank)))))) + (define (add-invalid-split split odd-row?) + (add-row table odd-row? used-columns + (xaccTransGetDate (xaccSplitGetParent split)) #f "" + (gnc:make-html-text + (gnc:html-markup-anchor + (gnc:split-anchor-text split) + (G_ "Invalid Split"))) + (xaccSplitGetMemo split) currency #f #f #f #f #f #f + link-option '(()))) + (define (make-invoice->payments-table invoice) (let ((lot (gncInvoiceGetPostedLot invoice))) (let lp ((lot-splits (gnc-lot-get-split-list lot)) @@ -744,8 +754,9 @@ (and (txn-is-invoice? txn) (or (null? invoice) (null? (gncInvoiceGetPostedLot invoice))))) - (gnc:warn "sanity check fail" txn) - (lp printed? odd-row? (cdr splits) total debit credit tax sale)) + (add-invalid-split (car splits) odd-row?) + (gnc:warn "sanity check fail" (car splits)) + (lp printed? (not odd-row?) (cdr splits) total debit credit tax sale)) ;; txn-date < start-date. skip display, accumulate amounts ((< (xaccTransGetDate (xaccSplitGetParent (car splits))) start-date)
https://github.com/Gnucash/gnucash/commit/a50c188dca02890c37af4c535b54fad5e2db13f2 Fixed for 4.2
*** Bug 797954 has been marked as a duplicate of this bug. ***