[GH-ISSUE #935] Bug: Sort by Size results in ERROR 500 #2089

Closed
opened 2026-03-01 17:56:22 +03:00 by kerem · 1 comment
Owner

Originally created by @akhilleusuggo on GitHub (Feb 24, 2022).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/935

Describe the bug

When I try to sort the snapshots by size error 500 appears. I can sort by name/url/title all of them without any problem. But the size breaks.

Steps to reproduce

1-Open the main page ( as admin ).
2-Click on "Sort by size".
3-Error 500

Screenshots or log output

Logs ;

Internal Server Error: /admin/core/snapshot/
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/contrib/admin/options.py", line 614, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/contrib/admin/sites.py", line 233, in inner
    return view(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1811, in changelist_view
    'selection_note': _('0 of %(cnt)s selected') % {'cnt': len(cl.result_list)},
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 269, in __len__
    self._fetch_all()
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 1308, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1143, in execute_sql
    sql, params = self.as_sql()
  File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 498, in as_sql
    extra_select, order_by, group_by = self.pre_sql_setup()
  File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 56, in pre_sql_setup
    order_by = self.get_order_by()
  File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 346, in get_order_by
    order_by.extend(self.find_ordering_name(
  File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 747, in find_ordering_name
    return [(OrderBy(transform_function(t, alias), descending=descending), False) for t in targets]
  File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 747, in <listcomp>
    return [(OrderBy(transform_function(t, alias), descending=descending), False) for t in targets]
  File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/query.py", line 1584, in transform
    return self.try_transform(wrapped, name)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/query.py", line 1198, in try_transform
    raise FieldError(
django.core.exceptions.FieldError: Unsupported lookup 'count' for AutoField or join on the field not permitted, perhaps you meant contains?
"GET /admin/core/snapshot/?o=4.-5.-1&tags__id__exact=11 HTTP/1.1" 500 145

ArchiveBox version


ArchiveBox v0.6.2
Cpython Linux Linux-5.4.0-100-generic-x86_64-with-glibc2.28 x86_64
IN_DOCKER=True DEBUG=False IS_TTY=True TZ=UTC SEARCH_BACKEND_ENGINE=ripgrep

[i] Dependency versions:
 √  ARCHIVEBOX_BINARY     v0.6.2          valid     /usr/local/bin/archivebox                                                   
 √  PYTHON_BINARY         v3.9.5          valid     /usr/local/bin/python3.9                                                    
 √  DJANGO_BINARY         v3.1.10         valid     /usr/local/lib/python3.9/site-packages/django/bin/django-admin.py           
 √  CURL_BINARY           v7.64.0         valid     /usr/bin/curl                                                               
 √  WGET_BINARY           v1.20.1         valid     /usr/bin/wget                                                               
 √  NODE_BINARY           v15.14.0        valid     /usr/bin/node                                                               
 √  SINGLEFILE_BINARY     v0.3.16         valid     /node/node_modules/single-file/cli/single-file                              
 √  READABILITY_BINARY    v0.0.2          valid     /node/node_modules/readability-extractor/readability-extractor              
 √  MERCURY_BINARY        v1.0.0          valid     /node/node_modules/@postlight/mercury-parser/cli.js                         
 √  GIT_BINARY            v2.20.1         valid     /usr/bin/git                                                                
 -  YOUTUBEDL_BINARY      -               disabled  /usr/local/bin/youtube-dl                                                   
 √  CHROME_BINARY         v90.0.4430.93   valid     /usr/bin/chromium                                                           
 √  RIPGREP_BINARY        v0.10.0         valid     /usr/bin/rg                                                                 

[i] Source-code locations:
 √  PACKAGE_DIR           22 files        valid     /app/archivebox                                                             
 √  TEMPLATES_DIR         3 files         valid     /app/archivebox/templates                                                   
 -  CUSTOM_TEMPLATES_DIR  -               disabled                                                                              

[i] Secrets locations:
 -  CHROME_USER_DATA_DIR  -               disabled                                                                              
 -  COOKIES_FILE          -               disabled                                                                              

[i] Data locations:
 √  OUTPUT_DIR            15 files        valid     /data                                                                       
 √  SOURCES_DIR           2361 files      valid     ./sources                                                                   
 √  LOGS_DIR              2 files         valid     ./logs                                                                      
 √  ARCHIVE_DIR           44895 files     valid     ./archive                                                                   
 √  CONFIG_FILE           81.0 Bytes      valid     ./ArchiveBox.conf                                                           
 √  SQL_INDEX             464.7 MB        valid     ./index.sqlite3

PS: I'm using Docker-Compose

Originally created by @akhilleusuggo on GitHub (Feb 24, 2022). Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/935 #### Describe the bug When I try to sort the snapshots by size error 500 appears. I can sort by name/url/title all of them without any problem. But the size breaks. #### Steps to reproduce 1-Open the main page ( as admin ). 2-Click on "Sort by size". 3-Error 500 #### Screenshots or log output ``` Logs ; Internal Server Error: /admin/core/snapshot/ Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python3.9/site-packages/django/contrib/admin/options.py", line 614, in wrapper return self.admin_site.admin_view(view)(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/django/utils/decorators.py", line 130, in _wrapped_view response = view_func(request, *args, **kwargs) File "/usr/local/lib/python3.9/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func response = view_func(request, *args, **kwargs) File "/usr/local/lib/python3.9/site-packages/django/contrib/admin/sites.py", line 233, in inner return view(request, *args, **kwargs) File "/usr/local/lib/python3.9/site-packages/django/utils/decorators.py", line 43, in _wrapper return bound_method(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/django/utils/decorators.py", line 130, in _wrapped_view response = view_func(request, *args, **kwargs) File "/usr/local/lib/python3.9/site-packages/django/contrib/admin/options.py", line 1811, in changelist_view 'selection_note': _('0 of %(cnt)s selected') % {'cnt': len(cl.result_list)}, File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 269, in __len__ self._fetch_all() File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 1308, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 53, in __iter__ results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size) File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1143, in execute_sql sql, params = self.as_sql() File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 498, in as_sql extra_select, order_by, group_by = self.pre_sql_setup() File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 56, in pre_sql_setup order_by = self.get_order_by() File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 346, in get_order_by order_by.extend(self.find_ordering_name( File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 747, in find_ordering_name return [(OrderBy(transform_function(t, alias), descending=descending), False) for t in targets] File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 747, in <listcomp> return [(OrderBy(transform_function(t, alias), descending=descending), False) for t in targets] File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/query.py", line 1584, in transform return self.try_transform(wrapped, name) File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/query.py", line 1198, in try_transform raise FieldError( django.core.exceptions.FieldError: Unsupported lookup 'count' for AutoField or join on the field not permitted, perhaps you meant contains? "GET /admin/core/snapshot/?o=4.-5.-1&tags__id__exact=11 HTTP/1.1" 500 145 ``` #### ArchiveBox version <!-- Run the `archivebox version` command locally then copy paste the result here: --> ```logs ArchiveBox v0.6.2 Cpython Linux Linux-5.4.0-100-generic-x86_64-with-glibc2.28 x86_64 IN_DOCKER=True DEBUG=False IS_TTY=True TZ=UTC SEARCH_BACKEND_ENGINE=ripgrep [i] Dependency versions: √ ARCHIVEBOX_BINARY v0.6.2 valid /usr/local/bin/archivebox √ PYTHON_BINARY v3.9.5 valid /usr/local/bin/python3.9 √ DJANGO_BINARY v3.1.10 valid /usr/local/lib/python3.9/site-packages/django/bin/django-admin.py √ CURL_BINARY v7.64.0 valid /usr/bin/curl √ WGET_BINARY v1.20.1 valid /usr/bin/wget √ NODE_BINARY v15.14.0 valid /usr/bin/node √ SINGLEFILE_BINARY v0.3.16 valid /node/node_modules/single-file/cli/single-file √ READABILITY_BINARY v0.0.2 valid /node/node_modules/readability-extractor/readability-extractor √ MERCURY_BINARY v1.0.0 valid /node/node_modules/@postlight/mercury-parser/cli.js √ GIT_BINARY v2.20.1 valid /usr/bin/git - YOUTUBEDL_BINARY - disabled /usr/local/bin/youtube-dl √ CHROME_BINARY v90.0.4430.93 valid /usr/bin/chromium √ RIPGREP_BINARY v0.10.0 valid /usr/bin/rg [i] Source-code locations: √ PACKAGE_DIR 22 files valid /app/archivebox √ TEMPLATES_DIR 3 files valid /app/archivebox/templates - CUSTOM_TEMPLATES_DIR - disabled [i] Secrets locations: - CHROME_USER_DATA_DIR - disabled - COOKIES_FILE - disabled [i] Data locations: √ OUTPUT_DIR 15 files valid /data √ SOURCES_DIR 2361 files valid ./sources √ LOGS_DIR 2 files valid ./logs √ ARCHIVE_DIR 44895 files valid ./archive √ CONFIG_FILE 81.0 Bytes valid ./ArchiveBox.conf √ SQL_INDEX 464.7 MB valid ./index.sqlite3 ``` <!-- Tickets without full version info will closed until it is provided, we need the full output here to help you solve your issue --> PS: I'm using Docker-Compose
kerem closed this issue 2026-03-01 17:56:23 +03:00
Author
Owner

@pirate commented on GitHub (Mar 13, 2022):

Duplicate of https://github.com/ArchiveBox/ArchiveBox/issues/857

<!-- gh-comment-id:1066028776 --> @pirate commented on GitHub (Mar 13, 2022): Duplicate of https://github.com/ArchiveBox/ArchiveBox/issues/857
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#2089
No description provided.