ValueError: time data ... does not match format

Hi,

Our environment: Ubuntu Server + MySql + erpnext V4
When upgrading our MySql db our erpnext installation stopped working.
The webbrowser only shows “Internal Server Error 500”
When looking at the worker.error.log file we see this line at the end :
ValueError: time data ‘\xe2\x80\cb0668-01-70 81:57:45’ does not match format ‘%Y-%m-%d %H:%M:%S’

Restoring the database to one of the backups does not help. Upgrading erpnext to Version 5 does not work either.
Can anyone help to get past this ?
Or does anyone know how we can find the record that has this strange date/time ?

Thanks,
Benjamien

v5 onwards requires MariaDB for microsecond precision. Please update your MySQL to MariaDB

Hi,

Thanks for the suggestion.
I updated to Mariadb, but now I get a new error.

Migrating site1.local
Executing frappe.patches.v5_0.v4_to_v5 in site1.local (1bd3e0294d)
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/benjamien/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 77, in
main()
File “/home/benjamien/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 14, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/benjamien/frappe-bench/env/local/lib/python2.7/site-packages/click /core.py”, line 664, in call
return self.main(*args, **kwargs)
File “/home/benjamien/frappe-bench/env/local/lib/python2.7/site-packages/click /core.py”, line 644, in main
rv = self.invoke(ctx)
File “/home/benjamien/frappe-bench/env/local/lib/python2.7/site-packages/click /core.py”, line 991, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/benjamien/frappe-bench/env/local/lib/python2.7/site-packages/click /core.py”, line 991, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/benjamien/frappe-bench/env/local/lib/python2.7/site-packages/click /core.py”, line 837, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/benjamien/frappe-bench/env/local/lib/python2.7/site-packages/click /core.py”, line 464, in invoke
return callback(*args, **kwargs)
File “/home/benjamien/frappe-bench/apps/frappe/frappe/commands.py”, line 28, i n _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/benjamien/frappe-bench/apps/frappe/frappe/commands.py”, line 205, in migrate
frappe.modules.patch_handler.run_all()
File "/home/benjamien/frappe-bench/apps/frappe/frappe/modules/patch_handler.py ", line 25, in run_all
if not run_single(patchmodule = patch):
File "/home/benjamien/frappe-bench/apps/frappe/frappe/modules/patch_handler.py ", line 52, in run_single
return execute_patch(patchmodule, method, methodargs)
File "/home/benjamien/frappe-bench/apps/frappe/frappe/modules/patch_handler.py ", line 68, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File "/home/benjamien/frappe-bench/apps/frappe/frappe/patches/v5_0/v4_to_v5.py ", line 18, in execute
frappe.reload_doc(module[0], “doctype”, doctype)
File “/home/benjamien/frappe-bench/apps/frappe/frappe/init.py”, line 555, in reload_doc
return frappe.modules.reload_doc(module, dt, dn, force=force)
File “/home/benjamien/frappe-bench/apps/frappe/frappe/modules/init.py”, li ne 37, in reload_doc
return import_files(module, dt, dn, force=force)
File “/home/benjamien/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 17, in import_files
return import_file(module, dt, dn, force=force)
File “/home/benjamien/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 22, in import_file
ret = import_file_by_path(path, force)
File “/home/benjamien/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 54, in import_file_by_path
import_doc(doc, force=force, data_import=data_import)
File “/home/benjamien/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 120, in import_doc
doc.insert()
File “/home/benjamien/frappe-bench/apps/frappe/frappe/model/document.py”, line 196, in insert
self.run_post_save_methods()
File “/home/benjamien/frappe-bench/apps/frappe/frappe/model/document.py”, line 561, in run_post_save_methods
self.run_method(“on_update”)
File “/home/benjamien/frappe-bench/apps/frappe/frappe/model/document.py”, line 509, in run_method
return Document.hook(fn)(self, *args, **kwargs)
File “/home/benjamien/frappe-bench/apps/frappe/frappe/model/document.py”, line 625, in composer
return composed(self, method, *args, **kwargs)
File “/home/benjamien/frappe-bench/apps/frappe/frappe/model/document.py”, line 608, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/benjamien/frappe-bench/apps/frappe/frappe/model/document.py”, line 503, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/benjamien/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doc type.py”, line 102, in on_update
updatedb(self.name)
File “/home/benjamien/frappe-bench/apps/frappe/frappe/model/db_schema.py”, lin e 62, in updatedb
tab.sync()
File “/home/benjamien/frappe-bench/apps/frappe/frappe/model/db_schema.py”, lin e 88, in sync
self.alter()
File “/home/benjamien/frappe-bench/apps/frappe/frappe/model/db_schema.py”, lin e 244, in alter
raise e
_mysql_exceptions.OperationalError: (1071, ‘Specified key was too long; max key length is 767 bytes’)

Any new suggestions ?

Thanks,
Benjamien

Maybe you have set an index on a Text field. Can you remove that? (new versions won’t allow you to do that)