App Versions
{
"frappe": "16.54.0",
"erpnext": "16.53.0",
"india_compliance": "16.11.0"
}
Route
Workspaces/Home
Traceback
Traceback (most recent call last):
File "apps/frappe/frappe/desk/query_report.py", line 328, in _run
result = generate_report_result(report, filters, user, custom_columns, is_tree, parent_field)
File "apps/frappe/frappe/__init__.py", line 510, in wrapper_fn
retval = fn(*args, **get_newargs(fn, kwargs))
File "apps/frappe/frappe/desk/query_report.py", line 123, in generate_report_result
res = get_report_result(report, filters) or []
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/desk/query_report.py", line 99, in get_report_result
res = report.execute_script_report(filters)
File "apps/frappe/frappe/core/doctype/report/report.py", line 210, in execute_script_report
res = self.execute_module(filters)
File "apps/frappe/frappe/core/doctype/report/report.py", line 232, in execute_module
return self.get_module_method("execute")(frappe._dict(filters))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "apps/erpnext/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py", line 42, in execute
income = get_data(
filters.company,
...<5 lines>...
ignore_closing_entries=True,
)
File "apps/erpnext/erpnext/accounts/report/financial_statements.py", line 369, in get_data
set_gl_entries_by_account(
~~~~~~~~~~~~~~~~~~~~~~~~~^
company,
^^^^^^^^
...<7 lines>...
ignore_closing_entries=ignore_closing_entries,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "apps/erpnext/erpnext/accounts/report/financial_statements.py", line 661, in set_gl_entries_by_account
gl_entries += get_accounting_entries(
~~~~~~~~~~~~~~~~~~~~~~^
"GL Entry",
^^^^^^^^^^^
...<9 lines>...
ignore_reporting_currency=ignore_reporting_currency,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "apps/erpnext/erpnext/accounts/report/financial_statements.py", line 758, in get_accounting_entries
return query.run(as_dict=True)
~~~~~~~~~^^^^^^^^^^^^^^
File "apps/frappe/frappe/query_builder/utils.py", line 144, in execute_query
result = frappe.local.db.sql(query, params, *args, **kwargs) # nosemgrep
File "apps/frappe/frappe/database/postgres/database.py", line 234, in sql
return super().sql(modify_query(query), modify_values(values), *args, **kwargs)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/database/database.py", line 272, in sql
self.execute_query(query, values)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "apps/frappe/frappe/database/database.py", line 372, in execute_query
return self._cursor.execute(query, values)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
psycopg2.errors.SyntaxError: syntax error at or near "INDEX"
LINE 1: ...s_opening","fiscal_year" FROM "tabGL Entry" FORCE INDEX ("po...
^
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "apps/frappe/frappe/app.py", line 133, in application
response = frappe.api.handle(request)
File "apps/frappe/frappe/api/__init__.py", line 63, in handle
data = endpoint(**arguments)
File "apps/frappe/frappe/api/v1.py", line 41, in handle_rpc_call
return frappe.handler.handle()
~~~~~~~~~~~~~~~~~~~~~^^
File "apps/frappe/frappe/handler.py", line 53, in handle
data = execute_cmd(cmd)
File "apps/frappe/frappe/handler.py", line 86, in execute_cmd
return frappe.call(method, **frappe.form_dict)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/__init__.py", line 1145, in call
return fn(*args, **newargs)
File "apps/frappe/frappe/utils/typing_validations.py", line 42, in wrapper
return func(*args, **kwargs)
File "apps/frappe/frappe/__init__.py", line 510, in wrapper_fn
retval = fn(*args, **get_newargs(fn, kwargs))
File "apps/frappe/frappe/desk/query_report.py", line 266, in run
return _run(
report_name=report_name,
...<6 lines>...
js_filters=js_filters,
)
File "apps/frappe/frappe/desk/query_report.py", line 331, in _run
frappe.log_error("Report execution failed for: {}".format(report_name))
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/utils/error.py", line 77, in log_error
error_log = frappe.get_doc(
doctype="Error Log",
...<6 lines>...
fingerprint=fingerprint,
)
File "apps/frappe/frappe/model/utils/__init__.py", line 225, in wrapper
return func(*args, **kw)
File "apps/frappe/frappe/model/document.py", line 348, in get_doc
return get_doc_from_dict(kwargs)
File "apps/frappe/frappe/model/document.py", line 373, in get_doc_from_dict
doc = controller(**data)
File "apps/frappe/frappe/model/document.py", line 460, in __init__
self.init_from_dict(kwargs)
~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "apps/frappe/frappe/model/document.py", line 472, in init_from_dict
self.update(d)
~~~~~~~~~~~^^^
File "apps/frappe/frappe/model/document.py", line 2305, in update
if not self._table_fieldnames or self.flags.get("ignore_children", False):
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.14/functools.py", line 1126, in __get__
val = self.func(instance)
File "apps/frappe/frappe/model/document.py", line 2489, in _table_fieldnames
return self.meta._table_doctypes
^^^^^^^^^
File "/usr/lib/python3.14/functools.py", line 1126, in __get__
val = self.func(instance)
File "apps/frappe/frappe/model/document.py", line 2262, in meta
return frappe.get_meta(self.doctype)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "apps/frappe/frappe/model/meta.py", line 85, in get_meta
meta = Meta(doctype)
File "apps/frappe/frappe/model/meta.py", line 149, in __init__
super().__init__("DocType", doctype)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/model/document.py", line 453, in __init__
self.load_from_db()
~~~~~~~~~~~~~~~~~^^
File "apps/frappe/frappe/model/meta.py", line 155, in load_from_db
super().load_from_db()
~~~~~~~~~~~~~~~~~~~~^^
File "apps/frappe/frappe/model/document.py", line 523, in load_from_db
d = frappe.db.get_value(
doctype=self.doctype,
...<3 lines>...
as_dict=True,
)
File "apps/frappe/frappe/database/database.py", line 564, in get_value
result = self.get_values(
doctype,
...<13 lines>...
wait=wait,
)
File "apps/frappe/frappe/database/database.py", line 680, in get_values
out = query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
File "apps/frappe/frappe/query_builder/utils.py", line 144, in execute_query
result = frappe.local.db.sql(query, params, *args, **kwargs) # nosemgrep
File "apps/frappe/frappe/database/postgres/database.py", line 234, in sql
return super().sql(modify_query(query), modify_values(values), *args, **kwargs)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/database/database.py", line 272, in sql
self.execute_query(query, values)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "apps/frappe/frappe/database/database.py", line 372, in execute_query
return self._cursor.execute(query, values)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
psycopg2.errors.InFailedSqlTransaction: current transaction is aborted, commands ignored until end of transaction block
Request Data
{
"type": "POST",
"args": {
"report_name": "Profit and Loss Statement",
"filters": "{\"filter_based_on\":\"Fiscal Year\",\"period_start_date\":\"2020-04-01\",\"period_end_date\":\"2021-03-31\",\"periodicity\":\"Yearly\",\"include_default_book_entries\":1,\"company\":\"Expedien eSolutions Pvt Ltd\",\"from_fiscal_year\":\"2026-2027\",\"to_fiscal_year\":\"2026-2027\"}",
"ignore_prepared_report": 1
},
"headers": {},
"error_handlers": {},
"silent": true,
"url": "/api/method/frappe.desk.query_report.run",
"request_id": null
}
Response Data
{
"exception": "",
"exc_type": "InFailedSqlTransaction",
"_exc_source": "erpnext (app)",
"_debug_messages": "[\"Syntax error in query:\\nSELECT \\\"account\\\",\\\"debit\\\",\\\"credit\\\",\\\"debit_in_account_currency\\\",\\\"credit_in_account_currency\\\",\\\"account_currency\\\",\\\"posting_date\\\",\\\"is_opening\\\",\\\"fiscal_year\\\" FROM \\\"tabGL Entry\\\" FORCE INDEX (\\\"posting_date_company_index\\\") WHERE \\\"company\\\"=%(param1)s AND \\\"is_cancelled\\\"= '0' AND \\\"posting_date\\\"<='2027-03-31' AND \\\"voucher_type\\\"<>%(param2)s AND \\\"posting_date\\\">='2026-04-01' AND (\\\"finance_book\\\" IN (%(param3)s,%(param4)s,%(param5)s) OR \\\"finance_book\\\" IS NULL) AND EXISTS (SELECT \\\"tabAccount\\\".\\\"name\\\" FROM \\\"tabAccount\\\" WHERE \\\"tabAccount\\\".\\\"name\\\"=\\\"tabGL Entry\\\".\\\"account\\\" AND \\\"tabAccount\\\".\\\"is_group\\\"= '0' AND \\\"tabAccount\\\".\\\"lft\\\">= '125' AND \\\"tabAccount\\\".\\\"rgt\\\"<= '134' AND \\\"tabAccount\\\".\\\"root_type\\\"=%(param6)s) {'param1': 'Expedien eSolutions Pvt Ltd', 'param2': 'Period Closing Voucher', 'param3': '', 'param4': '', 'param5': '', 'param6': 'Income'}\",\"Error in query:\\ncurrent transaction is aborted, commands ignored until end of transaction block\\n\"]"
}