Server Error: IndexError: list index out of range

I’m creating my own print format. However, during the work, I can’t save my work and a Server error is shown called “IndexError: list index out of range” even I didn’t use anything related to the range.
This is the second time I face the bug, I created a new format but after some saves it doesn’t work again.

I duplicate the format and now I can save the changes using the new one.
But I don’t want to create a new one every time I face this problem.

Please share the error traceback from the browser console for others to help you.

Press Cmd / Ctrl + Shift + J to open console.

Here it’s:

Traceback (most recent call last):
File “/opt/bench/erpnext/apps/frappe/frappe/”, line 66, in application
response = frappe.api.handle()
File “/opt/bench/erpnext/apps/frappe/frappe/”, line 54, in handle
return frappe.handler.handle()
File “/opt/bench/erpnext/apps/frappe/frappe/”, line 29, in handle
data = execute_cmd(cmd)
File “/opt/bench/erpnext/apps/frappe/frappe/”, line 65, in execute_cmd
return, **frappe.form_dict)
File “/opt/bench/erpnext/apps/frappe/frappe/”, line 1174, in call
return fn(*args, **newargs)
File “/opt/bench/erpnext/apps/frappe/frappe/”, line 146, in set_value
child = doc.getone({“doctype”: doctype, “name”: name})
File “/opt/bench/erpnext/apps/frappe/frappe/model/”, line 151, in getone
return self.get(key, filters=filters, limit=1)[0]
IndexError: list index out of range

I’m having the same issue with same error traceback. What did you end up doing?