Error when running bench update

I am trying to update my bench but I get this error any idea how this could be solved?

Executing erpnext.patches.v4_2.delete_gl_entries_for_cancelled_invoices in site1.local (1bd3e0294d)
Traceback (most recent call last):
File “/home/igor/frappe-bench/env/bin/frappe”, line 9, in
load_entry_point(‘frappe==4.13.4’, ‘console_scripts’, ‘frappe’)()
File “/home/igor/frappe-bench/apps/frappe/frappe/cli.py”, line 39, in main
ret = run(fn, args)
File “/home/igor/frappe-bench/apps/frappe/frappe/cli.py”, line 83, in run
out = globals().get(fn)(**args)
File “/home/igor/frappe-bench/apps/frappe/frappe/cli.py”, line 67, in new_fn
return fn(*args, **new_kwargs)
File “/home/igor/frappe-bench/apps/frappe/frappe/cli.py”, line 431, in latest
frappe.modules.patch_handler.run_all()
File “/home/igor/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 25, in run_all
if not run_single(patchmodule = patch):
File “/home/igor/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 50, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/igor/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 66, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/igor/frappe-bench/apps/erpnext/erpnext/patches/v4_2/delete_gl_entries_for_cancelled_invoices.py”, line 13, in execute
% (‘, ‘.join([’%s’]*len(cancelled_invoices))), tuple(cancelled_invoices))
File “/home/igor/frappe-bench/apps/frappe/frappe/database.py”, line 121, in sql
self._cursor.execute(query)
File “/home/igor/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/igor/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1064, “You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘)’ at line 2”)
Error: None
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench==0.1’, ‘console_scripts’, ‘bench’)()
File “/home/igor/bench-repo/bench/cli.py”, line 55, in cli
bench()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 610, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 590, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 936, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 782, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 416, in invoke
return callback(*args, **kwargs)
File “/home/igor/bench-repo/bench/cli.py”, line 247, in update
patch_sites()
File “/home/igor/bench-repo/bench/utils.py”, line 116, in patch_sites
exec_cmd(“{frappe} --latest all”.format(frappe=get_frappe(bench=bench)), cwd=os.path.join(bench, ‘sites’))
File “/home/igor/bench-repo/bench/utils.py”, line 72, in exec_cmd
subprocess.check_call(cmd, cwd=cwd, shell=True)
File “/usr/lib/python2.7/subprocess.py”, line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘/home/igor/frappe-bench/env/bin/frappe --latest all’ returned non-zero exit status 1

Please run bench update again