Skip to content
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

Uploading metadata causes the application crash #3230

Open
divinitus opened this issue Nov 20, 2024 · 14 comments
Open

Uploading metadata causes the application crash #3230

divinitus opened this issue Nov 20, 2024 · 14 comments

Comments

@divinitus
Copy link

divinitus commented Nov 20, 2024

version: docker.io/linuxserver/calibre-web:latest

root@44132842702d:/# calibre --version
calibre (calibre 7.21)

After selecting fetch metadata. I select lubimyczytac.pl as source. Identify matching book. Select it's cover. Metadata fields get populated. Selecting SAVE generates the following error in the calibre-web.log

Application container is no longer responsive. The book in question is LOST.
It's previous cover is gone, it's metadata is empty. Download links are 404.

[2024-11-19 15:15:12,486] ERROR {cps:838} Exception on /admin/book/2459 [GET]
Traceback (most recent call last):
  File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
  File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
  File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
  File "/app/calibre-web/cps/usermanagement.py", line 97, in decorated_view
    return login_required(func)(*args, **kwargs)
  File "/app/calibre-web/cps/cw_login/utils.py", line 296, in decorated_view
    return current_app.ensure_sync(func)(*args, **kwargs)
  File "/app/calibre-web/cps/editbooks.py", line 70, in inner
    return f(*args, **kwargs)
  File "/app/calibre-web/cps/editbooks.py", line 93, in show_edit_book
    return render_edit_book(book_id)
  File "/app/calibre-web/cps/editbooks.py", line 977, in render_edit_book
    return render_title_template('book_edit.html', book=book, authors=author_names, cc=cc,
  File "/app/calibre-web/cps/render_template.py", line 113, in render_title_template
    return render_template(instance=config.config_calibre_web_title, sidebar=sidebar, simple=simple,
  File "/lsiopy/lib/python3.10/site-packages/flask/templating.py", line 150, in render_template
    return _render(app, template, context)
  File "/lsiopy/lib/python3.10/site-packages/flask/templating.py", line 131, in _render
    rv = template.render(context)
  File "/lsiopy/lib/python3.10/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/lsiopy/lib/python3.10/site-packages/jinja2/environment.py", line 939, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/app/calibre-web/cps/templates/book_edit.html", line 1, in top-level template code
    {% extends "layout.html" %}
  File "/app/calibre-web/cps/templates/layout.html", line 168, in top-level template code
    {% block body %}{% endblock %}
  File "/app/calibre-web/cps/templates/book_edit.html", line 111, in block 'body'
    <input type="number" step="0.01" min="0" placeholder="1" class="form-control" name="series_index" id="series_index" value="{{book.series_index|formatfloat(2)}}">
  File "/app/calibre-web/cps/jinjia.py", line 116, in formatfloat
    formated_value = ('{0:.' + str(decimals) + 'f}').format(value)
ValueError: Unknown format code 'f' for object of type 'str'
@OzzieIsaacs
Copy link
Collaborator

Looks like the seriesindex from the provider loader is not a number but something else. Could you please tell me which book and which metadata provider you checked, so I can test what's going on?

OzzieIsaacs added a commit that referenced this issue Nov 20, 2024
@OzzieIsaacs
Copy link
Collaborator

I did a blind change, please update to the newest nightly channel (there should be a nightly docker available from LinuxServer)

@divinitus
Copy link
Author

Ebook upload:

[2024-11-21 15:22:37,767] DEBUG {cps.uploader:275} Temporary file: /tmp/calibre_web/939d56c08eb1ae55d82cec7014ea82e3
[2024-11-21 15:22:38,074]  WARN {py.warnings:109} /app/calibre-web/cps/editbooks.py:1405: SAWarning: Object of type <Books> not in session, add operation along 'Authors.books' won't proceed (This warning originated from the Session 'autoflush' process, which was invoked automatically in response to a user-initiated operation.)
  db_element = db_session.query(db_object).filter((func.lower(db_filter).ilike(add_element))).all()

[2024-11-21 15:22:38,076]  WARN {py.warnings:109} /app/calibre-web/cps/editbooks.py:1405: SAWarning: Object of type <Books> not in session, add operation along 'Languages.books' won't proceed (This warning originated from the Session 'autoflush' process, which was invoked automatically in response to a user-initiated operation.)
  db_element = db_session.query(db_object).filter((func.lower(db_filter).ilike(add_element))).all()

[2024-11-21 15:22:38,088] DEBUG {cps.helper:536} Moving title: /tmp/calibre_web/939d56c08eb1ae55d82cec7014ea82e3 to /books/Piotr Zychowicz/Obłęd '44_ czyli jak Polacy zrobili prezent Stalinowi, wywołując Powstanie Warszawskie (12654)
[2024-11-21 15:22:38,225] DEBUG {cps.services.worker:91} Add Task for user: divi - Upload Obłęd &#39;44: czyli jak Polacy zrobili prezent Stalinowi, wywołując Powstanie Warszawskie
[2024-11-21 15:22:38,226] DEBUG {cps.services.worker:91} Add Task for user: System - Add Cover Thumbnails for Book 12654

fetching the metdata from lubimyczytac.pl

Then i apply metadata:

[2024-11-21 15:25:20,745] DEBUG {cps.helper:541} Moving title: /books/Piotr Zychowicz/Obłęd '44_ czyli jak Polacy zrobili prezent Stalinowi, wywołując Powstanie Warszawskie (12654) to /books/Piotr Zychowicz/Obłęd '44. Czyli jak Polacy zrobili prezent Stalinowi, wywołując powstanie warszawskie (12654)
[2024-11-21 15:25:20,795] DEBUG {cps.services.worker:91} Add Task for user: System - Replace/Delete Cover Thumbnails for book 12654
[2024-11-21 15:25:20,796] DEBUG {cps.services.worker:91} Add Task for user: System - Add Cover Thumbnails for Book 12654

Result: ALL METADATA GONE. COVER GONE.
Only the "title" and "author", "publisher" and "published date" are still there

Links to download file are no longer valid and retunr 404

@OzzieIsaacs
Copy link
Collaborator

Please download the debug info package (on admin side) and post it here, or send it to me via private email

@divinitus
Copy link
Author

divinitus commented Nov 21, 2024 via email

@OzzieIsaacs
Copy link
Collaborator

? There is no file

@divinitus
Copy link
Author

@OzzieIsaacs
Copy link
Collaborator

I found nothing in the logbook, but I have an idea what caused the problem. I'm working on a fix, it's changing some parts deep in the system, currently approx. 30% of all tests fail, so it will take some time to release it

@OzzieIsaacs
Copy link
Collaborator

Please update to the newest nightly version and check again

@divinitus
Copy link
Author

That solved the issue! I can easily update metadata from lubimyczytac and the books are not being "lost". Kudos!

@OzzieIsaacs
Copy link
Collaborator

Great

@Domoel
Copy link

Domoel commented Jan 7, 2025

I have the same issue while performing a bulk import. How can I upgrade to the latest nightly version with docker?

@ceruleandeep
Copy link

I have the same issue while performing a bulk import. How can I upgrade to the latest nightly version with docker?

@Domoel change your Docker image from lscr.io/linuxserver/calibre-web:latest to lscr.io/linuxserver/calibre-web:nightly

@OzzieIsaacs thank you, I had this problem with several files on a fresh install of latest, and nightly fixes it

@waffledork
Copy link

@ceruleandeep any chance you know how to do this on Proxmox too? =)

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

No branches or pull requests

5 participants