Skip to content

Alert - Database Column Missing in ERPNext System #977

@magedbjn

Description

@magedbjn

Information about bug

An error occurred in the ERPNext system regarding a missing database column.
Error Summary:
Error Type: OperationalError
Error Code: 1054
Message: Unknown column 'loan_restructure_limit' in 'field list'
Table: tabBranch
Missing Column: loan_restructure_limit
This error occurred while executing the scheduled job "process_loan_restructure_limit.calculate_monthly_restructure_limit".

Traceback with variables (most recent call last):
File "apps/frappe/frappe/core/doctype/scheduled_job_type/scheduled_job_type.py", line 151, in execute
frappe.get_attr(self.method)()
self = <ScheduledJobType: process_loan_restructure_limit.calculate_monthly_restructure_limit>
File "apps/lending/lending/loan_management/doctype/process_loan_restructure_limit/process_loan_restructure_limit.py", line 25, in calculate_monthly_restructure_limit
limit_details = frappe.db.get_value(
branch = 'Nozoly'
posting_date = datetime.date(2025, 11, 1)
branches = [I Delete it]
company = ' i delete it'
File "apps/frappe/frappe/database/database.py", line 514, in get_value
result = self.get_values(
self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7fce439d4c90>
doctype = 'Branch'
filters = 'Nozoly'
fieldname = ['loan_restructure_limit', 'delinquent_limit']
ignore = None
as_dict = 1
debug = False
order_by = 'KEEP_DEFAULT_ORDERING'
cache = False
for_update = False
run = True
pluck = False
distinct = False
skip_locked = False
wait = True
File "apps/frappe/frappe/database/database.py", line 618, in get_values
out = self._get_values_from_table(
self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7fce439d4c90>
doctype = 'Branch'
filters = 'Nozoly'
fieldname = ['loan_restructure_limit', 'delinquent_limit']
ignore = None
as_dict = 1
debug = False
order_by = 'modified'
update = None
cache = False
for_update = False
run = True
pluck = False
distinct = False
limit = 1
skip_locked = False
wait = True
out = None
fields = ['loan_restructure_limit', 'delinquent_limit']
File "apps/frappe/frappe/database/database.py", line 891, in _get_values_from_table
return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7fce439d4c90>
fields = ['loan_restructure_limit', 'delinquent_limit']
filters = 'Nozoly'
doctype = 'Branch'
as_dict = 1
debug = False
order_by = 'modified'
update = None
for_update = False
skip_locked = False
wait = True
run = True
pluck = False
distinct = False
limit = 1
query = SELECT loan_restructure_limit,delinquent_limit FROM tabBranch WHERE name='Nozoly' ORDER BY modified DESC LIMIT 1
File "apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query
result = frappe.db.sql(query, params, *args, *kwargs) # nosemgrep
query = 'SELECT loan_restructure_limit,delinquent_limit FROM tabBranch WHERE name=%(param1)s ORDER BY modified DESC LIMIT 1'
args = ()
kwargs = {'as_dict': 1, 'debug': False, 'update': None, 'run': True, 'pluck': False}
child_queries = []
params = {'param1': 'Nozoly'}
execute_child_queries = <function patch_query_execute..execute_child_queries at 0x7fce43b9bf60>
prepare_query = <function patch_query_execute..prepare_query at 0x7fce43ba0040>
File "apps/frappe/frappe/database/database.py", line 230, in sql
self._cursor.execute(query, values)
self = <frappe.database.mariadb.database.MariaDBDatabase object at 0x7fce439d4c90>
query = 'SELECT loan_restructure_limit,delinquent_limit FROM tabBranch WHERE name=%(param1)s ORDER BY modified DESC LIMIT 1 /
FRAPPE_TRACE_ID: 355da9cb-2081-4afb-a484-df917b34d5d6 /'
values = {'param1': 'Nozoly'}
as_dict = 1
as_list = 0
debug = False
ignore_ddl = 0
auto_commit = 0
update = None
explain = False
run = True
pluck = False
as_iterator = False
trace_id = '355da9cb-2081-4afb-a484-df917b34d5d6'
File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 153, in execute
result = self._query(query)
self = <pymysql.cursors.Cursor object at 0x7fce43af9990>
query = "SELECT loan_restructure_limit,delinquent_limit FROM tabBranch WHERE name='Nozoly' ORDER BY modified DESC LIMIT 1 /
FRAPPE_TRACE_ID: 355da9cb-2081-4afb-a484-df917b34d5d6 /"
args = {'param1': 'Nozoly'}
File "env/lib/python3.11/site-packages/pymysql/cursors.py", line 322, in _query
conn.query(q)
self = <pymysql.cursors.Cursor object at 0x7fce43af9990>
q = "SELECT loan_restructure_limit,delinquent_limit FROM tabBranch WHERE name='Nozoly' ORDER BY modified DESC LIMIT 1 /
FRAPPE_TRACE_ID: 355da9cb-2081-4afb-a484-df917b34d5d6 /"
conn = <pymysql.connections.Connection object at 0x7fce4275ddd0>
File "env/lib/python3.11/site-packages/pymysql/connections.py", line 563, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
self = <pymysql.connections.Connection object at 0x7fce4275ddd0>
sql = b"SELECT loan_restructure_limit,delinquent_limit FROM tabBranch WHERE name='Nozoly' ORDER BY modified DESC LIMIT 1 /
FRAPPE_TRACE_ID: 355da9cb-2081-4afb-a484-df917b34d5d6 */"
unbuffered = False
File "env/lib/python3.11/site-packages/pymysql/connections.py", line 825, in _read_query_result
result.read()
self = <pymysql.connections.Connection object at 0x7fce4275ddd0>
unbuffered = False
result = <pymysql.connections.MySQLResult object at 0x7fce41d77490>
File "env/lib/python3.11/site-packages/pymysql/connections.py", line 1199, in read
first_packet = self.connection._read_packet()
self = <pymysql.connections.MySQLResult object at 0x7fce41d77490>
File "env/lib/python3.11/site-packages/pymysql/connections.py", line 775, in _read_packet
packet.raise_for_error()
self = <pymysql.connections.Connection object at 0x7fce4275ddd0>
packet_type = <class 'pymysql.protocol.MysqlPacket'>
buff = bytearray(b"\xff\x1e\x04#42S22Unknown column 'loan_restructure_limit' in 'field list'")
packet_header = b'@\x00\x00\x01'
btrl = 64
btrh = 0
packet_number = 1
bytes_to_read = 64
recv_data = b"\xff\x1e\x04#42S22Unknown column 'loan_restructure_limit' in 'field list'"
packet = <pymysql.protocol.MysqlPacket object at 0x7fce41d47f40>
File "env/lib/python3.11/site-packages/pymysql/protocol.py", line 219, in raise_for_error
err.raise_mysql_exception(self._data)
self = <pymysql.protocol.MysqlPacket object at 0x7fce41d47f40>
errno = 1054
File "env/lib/python3.11/site-packages/pymysql/err.py", line 150, in raise_mysql_exception
raise errorclass(errno, errval)
data = b"\xff\x1e\x04#42S22Unknown column 'loan_restructure_limit' in 'field list'"
errno = 1054
errval = "Unknown column 'loan_restructure_limit' in 'field list'"
errorclass = <class 'pymysql.err.OperationalError'>
pymysql.err.OperationalError: (1054, "Unknown column 'loan_restructure_limit' in 'field list'")

Module

Loan Management

Version

Frappe Framework: v15.87.0 (HEAD)
ERPNext: v15.85.0 (HEAD)
Frappe Lending: v0.0.1 (HEAD)

Installation method

FrappeCloud

Relevant log output / Stack trace / Full Error Message.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions