Error creating share links

Hi all,

I’m trying to create a share link from a file I just uploaded onto a Shared library I have just for sharing files. It’s been months/years since I don’t use it, but needed to share something now. Anyway, after successfully uploading the file there (from the webpage), I click on share…and get “error”. This gives no information at all.
If I try with the client, I get this in applet.log:

[Wednesday, October 09, 2024 05:58:10 PM HKT]request failed for https://myserver/api/v2.1/share-links/: <!DOCTYPE html>
<html lang="en">
<head>
    <title>Page unavailable</title>
</head>
<body>
    <h1>Page unavailable</h1>

    <p>Sorry, but the requested page is unavailable due to a server hiccup.</p>

    <p>Our engineers have been notified, so check back later.</p>
</body>
</html>


[Wednesday, October 09, 2024 05:58:14 PM HKT]Failed to generate share link: Server Error

Then, checking on the server I found this on seahub.log (not sure if related, but it’s the last entry as of now, and I think refers some sharing libraries):


MySQLdb.DataError: (1406, "Data too long for column 'token' at row 1")

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

Traceback (most recent call last):
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/views/decorators/csrf.py", line 56, in wrapper_view
    return view_func(*args, **kwargs)
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/seahub/share/decorators.py", line 112, in _decorated
    return func(view, request, *args, **kwargs)
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/seahub/api2/endpoints/share_links.py", line 476, in post
    fs = FileShare.objects.create_file_link(username, repo_id, path,
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/seahub/share/models.py", line 157, in create_file_link
    return self._add_file_share(username, repo_id, path, 'f', password,
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/seahub/share/models.py", line 115, in _add_file_share
    fs = super(FileShareManager, self).create(
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/db/models/query.py", line 658, in create
    obj.save(force_insert=True, using=self.db)
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/db/models/base.py", line 814, in save
    self.save_base(
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/db/models/base.py", line 877, in save_base
    updated = self._save_table(
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/db/models/base.py", line 1020, in _save_table
    results = self._do_insert(
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/db/models/base.py", line 1061, in _do_insert
 File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/db/models/query.py", line 1805, in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/db/models/sql/compiler.py", line 1822, in execute_sql
    cursor.execute(sql, params)
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/media/seafile/lxc/seafile-server-11.0.9/seahub/thirdpart/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/media/seafile/lxc/seafile-server-11.0.9/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.DataError: (1406, "Data too long for column 'token' at row 1")
2024-10-09 10:03:00,585 [WARNING] django.request:241 log_response Not Found: /api/v2.1/share-links/:

Sounds like some db migration script failed at one point when upgrading Seafile. This post should help you.