Calibre-Web: Internal Server Error uploading anything

Hi All,

I moved my Calibre-Web library and database to my TrueNAS Scale box, created a new App on TrueNAS (ElectricEel-24.10.1, App: 1.0.9 (0.6.22)) and I’m facing the following issue…

It is not possible to upload anything. Existing books are fine, metadata can be edited, users can be managed, however any upload attempt looks like this:

[2025-01-23 23:44:54,683] ERROR {cps:1414} Exception on /upload [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/tmp/calibre-web/cps/usermanagement.py", line 35, in decorated_view
    return login_required(func)(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/flask_login/utils.py", line 290, in decorated_view
    return current_app.ensure_sync(func)(*args, **kwargs)
  File "/tmp/calibre-web/cps/editbooks.py", line 59, in inner
    return f(*args, **kwargs)
  File "/tmp/calibre-web/cps/editbooks.py", line 249, in upload
    meta, error = file_handling_on_upload(requested_file)
  File "/tmp/calibre-web/cps/editbooks.py", line 755, in file_handling_on_upload
    if not validate_mime_type(requested_file, allowed_extensions):
  File "/tmp/calibre-web/cps/file_helper.py", line 49, in validate_mime_type
    mime = magic.Magic(mime=True)
NameError: name 'magic' is not defined

Any idea welcome.

Thanks.

And just as I post this, a new version drops. Sadly it’s not possible to update from here to the new version. It shows an error with something like “dict expected” or the like.
I have deleted the App (I have the configs in a dataset safe) and re-installed. I had issues with the ports. Host networking doesn’t work and exposing for inter-container communication ends up sharing port 8083… not the best, but at least it works and I am able to upload now.
Thanks for the fix! :slight_smile: