Calibre-web crash when using "default" database

Greetings,

I’m trying to use your docker image for calibre-web. My docker-compose.yml looks like this:

---
version: "2.1"
services:
  calibre-web:
    image: lscr.io/linuxserver/calibre-web:latest
    container_name: calibre-web
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Rome
      - DOCKER_MODS=linuxserver/mods:universal-calibre     #  optional
      - OAUTHLIB_RELAX_TOKEN_SCOPE=1     #  optional
    volumes:
      - /STORAGE/calibre/config:/config
      - /STORAGE/calibre/books:/books
    ports:
      - 8083:8083
    restart: unless-stopped

Since I don’t have a pre-existing calibre db, I’m using the one provided by the calibre-web folks as said in the quick start section here.
Everything seems fine, but after logging in with the default credentials, if I try to navigate to some UI sections I get the following error:


Calibre-Web
500 Internal Server Error
The server encountered an internal error and was unable to complete your request. There is an error in the application.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1519, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1517, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.10/dist-packages/flask/app.py", line 1503, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/app/calibre-web/cps/usermanagement.py", line 35, in decorated_view
return login_required(func)(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/flask_login/utils.py", line 290, in decorated_view
return current_app.ensure_sync(func)(*args, **kwargs)
File "/app/calibre-web/cps/web.py", line 790, in index
return render_books_list("newest", sort_param, 1, page)
File "/app/calibre-web/cps/web.py", line 408, in render_books_list
entries, random, pagination = calibre_db.fill_indexpage(page, 0, db.Books, True, order[0],
File "/app/calibre-web/cps/db.py", line 782, in fill_indexpage
return self.fill_indexpage_with_archived_books(page, database, pagesize, db_filter, order, False,
File "/app/calibre-web/cps/db.py", line 789, in fill_indexpage_with_archived_books
random_query = self.generate_linked_query(config_read_column, database)
File "/app/calibre-web/cps/db.py", line 743, in generate_linked_query
query = (self.session.query(database, ub.ArchivedBook.is_archived, ub.ReadBook.read_status)
AttributeError: 'NoneType' object has no attribute 'query'

I described this error in greater detail here. According to the calibre-web people, this is a permissions error. But I don’t know how this could happen. I checked my UID and GID and are the same values reported in the docker-compose file:

$ id giacomo
uid=1000(giacomo) gid=1000(giacomo) groups=1000(giacomo),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),116(lxd),117(docker),1002(storage)

I even tried to download the database from inside the Docker container and chown it to the user abc, since it seems that it’s the user that’s running calibre-web inside the container, but still nothing. What am I missing?
Thank you for your help,

GTP

Edit: just to be precise, after filling the GitHub issue I actually decided to mount a directory that isn’t a Nextcloud one inside the Docker container, as I figured out that without an auto-import feature, it doesn’t make sense to have a Nextcloud directory mounted there.

Turned out that this wasn’t a permissions issue, just that I wasn’t downloading the database correctly (I had to use the “raw” link since I was using wget, that is https://github.com/janeczku/calibre-web/raw/master/library/metadata.db). Now it works.

1 Like