Exception in Seafile Server 12 after upgrade from 11

Hey @daniel.pan

I have just upgraded from v11.x to 12.0.11. In the new web-ui I observe an error when I click on the free space next to an image

I get the following exception:

[2025-03-29 21:56:30] [ERROR] django.request:241 log_response Internal Server Error: /api2/repos/9740e6ed-68b1-47eb-8245-f3cee0215875/file/detail/
Traceback (most recent call last):
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/db/backends/utils.py”, line 89, in _execute
return self.cursor.execute(sql, params)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/db/backends/mysql/base.py”, line 75, in execute
return self.cursor.execute(query, args)
File “/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py”, line 179, in execute
res = self._query(mogrified_query)
File “/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py”, line 330, in _query
db.query(q)
File “/usr/local/lib/python3.8/dist-packages/MySQLdb/connections.py”, line 280, in query
_mysql.connection.query(self, query)
MySQLdb.OperationalError: (1054, “Unknown column ‘base_filecomment.uuid_id’ in ‘where clause’”)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/core/handlers/exception.py”, line 55, in inner
response = get_response(request)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/core/handlers/base.py”, line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/views/decorators/csrf.py”, line 56, in wrapper_view
return view_func(*args, **kwargs)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/views/generic/base.py”, line 104, in view
return self.dispatch(request, *args, **kwargs)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/seahub/api2/base.py”, line 23, in dispatch
response = super(APIView, self).dispatch(*a, **kw)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/rest_framework/views.py”, line 509, in dispatch
response = self.handle_exception(exc)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/seahub/api2/base.py”, line 20, in handle_exception
return super(APIView, self).handle_exception(exc)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/rest_framework/views.py”, line 469, in handle_exception
self.raise_uncaught_exception(exc)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/rest_framework/views.py”, line 480, in raise_uncaught_exception
raise exc
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/rest_framework/views.py”, line 506, in dispatch
response = handler(request, args, **kwargs)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/seahub/api2/views.py”, line 3416, in get
comment_total = file_comments.count()
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/db/models/query.py”, line 608, in count
return self.query.get_count(using=self.db)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/db/models/sql/query.py”, line 568, in get_count
return obj.get_aggregation(using, {“__count”: Count("
“)})[”__count"]
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/db/models/sql/query.py”, line 554, in get_aggregation
result = compiler.execute_sql(SINGLE)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/db/models/sql/compiler.py”, line 1562, in execute_sql
cursor.execute(sql, params)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/db/backends/utils.py”, line 67, in execute
return self._execute_with_wrappers(
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/db/backends/utils.py”, line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/db/backends/utils.py”, line 89, in _execute
return self.cursor.execute(sql, params)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/db/utils.py”, line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/db/backends/utils.py”, line 89, in _execute
return self.cursor.execute(sql, params)
File “/home/seafile-service/seafile/seafile-server-12.0.11/seahub/thirdpart/django/db/backends/mysql/base.py”, line 75, in execute
return self.cursor.execute(query, args)
File “/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py”, line 179, in execute
res = self._query(mogrified_query)
File “/usr/local/lib/python3.8/dist-packages/MySQLdb/cursors.py”, line 330, in _query
db.query(q)
File “/usr/local/lib/python3.8/dist-packages/MySQLdb/connections.py”, line 280, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1054, “Unknown column ‘base_filecomment.uuid_id’ in ‘where clause’”)

This looks like a problem I had where I was missing some tables and some columns in other tables. My solution was to run the /opt/seafile/seafile-server-12.0.6/sql/mysql/seafile.sql file (inside the container) which created all the missing tables and columns.

If you want details, here’s my forum thread: After upgrade to Seafile 12.06 can't upload files because database table missing

To fix database errors, particularly during upgrades, you can log into the database directly and run the SQL upgrade statements manually.

For the correct version of MySQL tables, refer to the following links:

If you are using a Docker-based deployment, you can connect to the MySQL service with the command:
docker exec -it seafile-mysql mysql -uroot -pxxx