Unable to delete a device in admin (internal error)


I have an internal error when I try to delete an old device in the admin panel (seafile CE 9.0.7):

seahub log

2022-09-01 08:20:18,254 [ERROR] seahub.utils.devices:27 do_unlink_device failed to delete_repo_tokens_by_peer_id
Traceback (most recent call last):
File “/opt/seablue/seafile-server-9.0.7/seahub/seahub/utils/devices.py”, line 23, in do_unlink_device
if seafile_api.delete_repo_tokens_by_peer_id(username, device_id) < 0:
File “/opt/seablue/seafile-server-9.0.7/seafile/lib/python3/site-packages/seaserv/api.py”, line 712, in delete_repo_tokens_by_peer_id
return seafserv_threaded_rpc.delete_repo_tokens_by_peer_id(email, peer_id)
File “/opt/seablue/seafile-server-9.0.7/seafile/lib/python3/site-packages/pysearpc/client.py”, line 127, in newfunc
return fret(ret_str)
File “/opt/seablue/seafile-server-9.0.7/seafile/lib/python3/site-packages/pysearpc/client.py”, line 11, in _fret_int
raise SearpcError(dicts[‘err_msg’])
pysearpc.common.SearpcError: DB error
2022-09-01 08:20:18,256 [ERROR] seahub.api2.endpoints.admin.devices:105 delete DB error
2022-09-01 08:20:18,256 [ERROR] django.request:230 log_response Internal Server Error: /api/v2.1/admin/devices/

seafile log

2022-09-01 08:20:18 …/common/seaf-db.c(1302): sqlite3_prepare_v2 failed DELETE u., p. FROM RepoUserToken u, RepoTokenPeerInfo p WHERE u.token=p.token AND u.email = ? AND p.peer_id = ?: near “u”: syntax error

We will check the issue.