Report Accounts Payable report_view.js:31:33

At on-prem ERPNext trying to execute standard “Accounts Payable” report:
app/purchase-invoice/view/report/Accounts%20Payable

Which crashes with error:

VM6885:1 Uncaught (in promise) SyntaxError: "undefined" is not valid JSON
    at JSON.parse (<anonymous>)
    at report_view.js:31:33
(anonymous)	@	report_view.js:31

Any idea how to get further info what is the problem and how to solve it?

If I go back and try to run he next “Accounts Payable Summary”:

desk.bundle.js:102 "" is not a valid color.

||(anonymous)|@|desk.bundle.js:102|
| --- | --- | --- | --- |
||make_chart|@|utils.js:1255|
||t|@|chart_widget.js:534|
||callback|@|model.js:283|
||e|@|request.js:85|
||200|@|request.js:133|
||(anonymous)|@|request.js:305|
|||

VM6928:1 Uncaught (in promise) SyntaxError: "undefined" is not valid JSON at JSON.parse (<anonymous>) at report_view.js:31:33

(anonymous) @ report_view.js:31

Any idea how to get further info what is the problem and how to solve it?

@alex-g-s check this

1 Like

Thank you Jeel for fast reaction.
My problem is one row above the filters.

Uncaught (in promise) SyntaxError: "undefined" is not valid JSON
    at JSON.parse (<anonymous>)
    at report_view.js:31:33

this.report_doc.json is not existing.
If I go through “Report list” → search for “Purchase Register” and open the report. Then I click “Show report” it is working.

But if I go through Accounting → Payables → under “Reports” click on the standard “Purchase Register” it shows almost blank page and the above error.
This is the screen as result:

If in Javascript debug I clear the this.report_name to make this fail

if (this.report_name) {

and to go in the ELSE branch, then it works and loads.

		if (this.report_name) {
			return this.get_report_doc().then((doc) => {
				this.report_doc = doc;
				this.report_doc.json = JSON.parse(this.report_doc.json);

				this.filters = this.report_doc.json.filters;
				this.order_by = this.report_doc.json.order_by;
				this.add_totals_row = this.report_doc.json.add_totals_row;
				this.page_title = __(this.report_name);
				this.page_length = this.report_doc.json.page_length || 20;
				this.order_by = this.report_doc.json.order_by || "modified desc";
				this.chart_args = this.report_doc.json.chart_args;
			});
		} else {
			this.add_totals_row = this.view_user_settings.add_totals_row || 0;
			this.chart_args = this.view_user_settings.chart_args;
		}

And this is the case for all the standard defined reports under “Reports”:

  • Accounts Payable
  • Accounts Payable Summary
  • Purchase Register
  • Item-wise Purchase Register
  • Purchase Order Analysis
  • Received Items To Be Billed
  • Supplier Ledger Summary

I thought it might be some cache and executed:

bench clear-cache
bench clear-website-cache
bench restart

But this didn’t help too.

The site was working properly for several months. These days I started testing and implementation of payments / bank reconciliation.

Thanks to @Jeel

I’ve updated to latest version:

Installed Apps

ERPNext: v15.55.4 (version-15)
Frappe Framework: v15.63.0 (version-15)

Which solved the problem.