New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Seafile-server 6.0.0] Use valid default tokenv2 creation datetime #1738

wants to merge 1 commit into
base: master


None yet
2 participants
Copy link

edacval commented Aug 13, 2016

After upgrade, Seahub crashes with error:

2016-08-13 01:43:03,844 [ERROR] django.request:256 handle_uncaught_exception Internal Server Error: /api2/account/info/
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/django/core/handlers/", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python2.7/site-packages/django/views/decorators/", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/views/generic/", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/srv/seafile/", line 23, in dispatch
    response = super(APIView, self).dispatch(*a, **kw)
  File "/usr/lib/python2.7/site-packages/rest_framework/", line 466, in dispatch
    response = self.handle_exception(exc)
  File "/srv/seafile/", line 20, in handle_exception
    return super(APIView, self).handle_exception(exc)
  File "/usr/lib/python2.7/site-packages/rest_framework/", line 454, in dispatch
    self.initial(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/rest_framework/", line 376, in initial
  File "/usr/lib/python2.7/site-packages/rest_framework/", line 310, in perform_authentication
  File "/usr/lib/python2.7/site-packages/rest_framework/", line 353, in __getattribute__
    return super(Request, self).__getattribute__(attr)
  File "/usr/lib/python2.7/site-packages/rest_framework/", line 193, in user
  File "/usr/lib/python2.7/site-packages/rest_framework/", line 316, in _authenticate
    user_auth_tuple = authenticator.authenticate(self)
  File "/srv/seafile/", line 63, in authenticate
    ret = self.authenticate_v2(request, key)
  File "/srv/seafile/", line 92, in authenticate_v2
    token = TokenV2.objects.get(key=key)
  File "/usr/lib/python2.7/site-packages/django/db/models/", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/db/models/", line 328, in get
    num = len(clone)
  File "/usr/lib/python2.7/site-packages/django/db/models/", line 144, in __len__
  File "/usr/lib/python2.7/site-packages/django/db/models/", line 965, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/usr/lib/python2.7/site-packages/django/db/models/", line 238, in iterator
    results = compiler.execute_sql()
  File "/usr/lib/python2.7/site-packages/django/db/models/sql/", line 840, in execute_sql
    cursor.execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/backends/", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/backends/sqlite3/", line 318, in execute
    return Database.Cursor.execute(self, query, params)
  File "/usr/lib/python2.7/site-packages/django/db/backends/sqlite3/", line 69, in <lambda>
    return lambda s: conv_func(s.decode('utf-8'))
  File "/usr/lib/python2.7/site-packages/django/db/backends/sqlite3/", line 7, in parse_datetime_with_timezone_support
    dt = parse_datetime(value)
  File "/usr/lib/python2.7/site-packages/django/utils/", line 109, in parse_datetime
    return datetime.datetime(**kw)
ValueError: year is out of range

According to, the smallest year number allowed in a date or datetime object. MINYEAR is 1

Quick workaround:

sqlite3 /path/to/seahub.db
UPDATE api2_tokenv2 SET created_at='0001-01-01 00:00:00' WHERE created_at='0000-00-00 00:00:00';

This comment has been minimized.

Copy link

xiez commented Aug 15, 2016

Hi @edacval, this issue is fixed in #1739, thanks for reporting!

@edacval edacval closed this Aug 15, 2016

@edacval edacval deleted the edacval:fix-default-token-creation-time branch Aug 15, 2016

@edacval edacval restored the edacval:fix-default-token-creation-time branch Aug 15, 2016

@edacval edacval deleted the edacval:fix-default-token-creation-time branch Aug 15, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment