Unknown Column Error Issue

Hello Everyone,

I was editing some custom fields in Issue document and I got this error now and I can’t login no more

ERPNext: v7 (developer branch)
Frappe: v7 (developer branch)

Oops, a server error has occured

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 25, in render
data = render_page_by_language(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 91, in render_page_by_language
return render_page(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 107, in render_page
return build(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 114, in build
return build_page(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 127, in build_page
context = get_context(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/context.py”, line 16, in get_context
context = build_context(context)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/context.py”, line 64, in build_context
ret = module.get_context(context)
File “/home/frappe/frappe-bench/apps/frappe/frappe/templates/pages/desk.py”, line 21, in get_context
boot = frappe.sessions.get()
File “/home/frappe/frappe-bench/apps/frappe/frappe/sessions.py”, line 107, in get
bootinfo[“notification_info”] = get_notification_info_for_boot()
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/notifications.py”, line 133, in get_notification_info_for_boot
out = get_notifications()
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/notifications.py”, line 26, in get_notifications
“open_count_doctype”: get_notifications_for_doctypes(config, notification_count),
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/notifications.py”, line 92, in get_notifications_for_doctypes
filters=condition, limit_page_length = 21, as_list=True, ignore_ifnull=True))
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1055, in get_list
return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 78, in execute
result = self.build_and_run()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 102, in build_and_run
return frappe.db.sql(query, as_dict=not self.as_list, debug=self.debug)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 147, in sql
self._cursor.execute(query)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1054, “Unknown column ‘tabIssue.complaint_date’ in ‘order clause’”)

I can’t access any other page.

Already read all the similar topics, and bech migrate didn’t solve the problem.

Hi, maybe try to remove your changes and then run bench restart and bench migrate.

@NMyshuk
Unfortunately I can’t, I’m stuck in this page:

Is there any way to do this via command line?

I noticed that users that do not have access to support can login, but they don’t have permission to personalize forms.

If I understood correctly you can use command line, so please run
bench export-fixtures
then go to fixtures/custom_field.json
find and remove your changes, save and then try again run bench migrate

@NMyshuk

Here is the output of “bench export-fixtures”

$ bench export-fixtures
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/utils.py”, line 202, in export_fixtures
frappe.init(site=site)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 122, in init
local.conf = _dict(get_site_config())
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 174, in get_site_config
config.update(get_file_json(site_config))
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 831, in get_file_json
return json.load(f)
File “/usr/lib/python2.7/json/init.py”, line 290, in load
**kw)
File “/usr/lib/python2.7/json/init.py”, line 338, in loads
return _default_decoder.decode(s)
File “/usr/lib/python2.7/json/decoder.py”, line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python2.7/json/decoder.py”, line 382, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting , delimiter: line 5 column 2 (char 88)

Now bench update fails and I get “Internal Server Error” when I try to access via browser

@NMyshuk

Sorry, I tried to activate developer mode and this caused the error.

The actual output of bench export-fixtures is:

$ bench export-fixtures
Exporting Web Form app erpnext filters None

I don’t know what happened, couldn’t find custom_fields.json

I think I just have to restore defaults for this form, but I don’t know how to do it via command line

Oh, sorry please update in hooks.py
fixtures = [“Web Form”, “Custom Field”]
and then again:
bench export-fixtures
then go to fixtures/custom_field.json
find and remove your changes, save and then try again run bench migrate

1 Like

@NMyshuk

Apparently the problem is not in the custom field, but in the order clause (maybe I selected a custom field and then deleted the field).

How can I restore defaults for this form? Or how can I edit this specific setting?

Sorry, but I don’t know about restore defaults. In fixtures/custom_field.json you can edit your custom fields.

1 Like

@NMyshuk

Thank you very much!

I created the field “complaint date”, so then I was able to login, then I changed the order clause and deleted the custom field again, all fine now.

1 Like