django.db.utils.ProgrammingError: 1064, You have an error in your SQL syntax

Dear all,

When trying to share a file by sending an email notification, I receive the following error

2023-12-10 18:35:44,537 [ERROR] django.request:241 log_response Internal Server Error: /api/v2.1/repo-folder-share-info/
Traceback (most recent call last):
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/django/db/backends/utils.py", line 87, in _execute
    return self.cursor.execute(sql)
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/connections.py", line 254, in query
    _mysql.connection.query(self, query)
MySQLdb.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 '-db.SharedRepo s\n            WHERE\n                repo_id = 'da036387-ba1b-4...' at line 4")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/django/views/decorators/csrf.py", line 56, in wrapper_view
    return view_func(*args, **kwargs)
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/opt/seafile/seafile-server-11.0.2/seahub/seahub/api2/endpoints/repo_folder_share_info.py", line 88, in get
    share_info_list += seafile_db.get_repo_user_share_list(repo_id,
  File "/opt/seafile/seafile-server-11.0.2/seahub/seahub/utils/db_api.py", line 62, in get_repo_user_share_list
    cursor.execute(sql)
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/django/db/backends/utils.py", line 87, in _execute
    return self.cursor.execute(sql)
  File "/opt/seafile/seafile-server-11.0.2/seahub/thirdpart/django/db/backends/mysql/base.py", line 75, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/lib/python3.10/dist-packages/MySQLdb/connections.py", line 254, in query
    _mysql.connection.query(self, query)
django.db.utils.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 '-db.SharedRepo s\n            WHERE\n                repo_id = 'da036387-ba1b-4...' at line 4")

Screenshot 2023-12-10 184643

I am not sure this is due to my set up, I’d rather think it’s an issue with Seahub or Django. Any ideas?

Seafile Server v11.0.2 with Docker.

1 Like

Just chiming in to say I’m having the exact same issue on Seafile v11.0.2 but not on docker with MySQL v8.0.35-0. It seems to happen any time I load a library on the web GUI. I also can’t upload or download files.

Seeing similar error with v11.0.3 and standalone installation + MariaDB 10.6
Yet I did not observe any functional limitations so far.

Same for me. Seafile Pro 11.0.4_x86-64_Ubuntu with mariadb Ver 15.1 Distrib 10.11.6-MariaDB, running on Debian 12.4.

So far I’ve only noticed it when I create a new library. Upon library creation the web UI displays “Error” for a couple of secs via some sort of pop-up/overlay widget thingie. Also, the new library doesn’t show until I hit refresh.

This bug should have been fixed in version 11.0.5-pro.

image

seafile-db has been been quoted in the latest version.

1 Like