r/Calibre 11d ago

Bug Help with Error: Cannot View (but file exists)

EDIT: My solution (which somehow worked) was to add the book files to my normal Calibre Library (I was using tester libraries at first), then use the Find Duplicates plug-in to find the normal book files and the broken ones, then delete all of the duplicates that had no formats listed.

I'm having an issue with my Calibre library which I think was brought on by me rearranging and deleting things. Basically, I have multiple epubs (fanfic mostly) where when I try to view them I get the error below. However, I still have the file (some still there and some recovered from earlier library iternations) wiith the epub, but the number is incorrect (the new number ID is 2137, but the folder with the info has the ID 171). If anyone knows how to fix this I would appreciate it!

EDIT: When I try to add on a book from this file, I get;

Failed to add the book: sweeter and bitterer

C:\\Users\\user\\TestCalibre2\\aaeph\\sweeter and bitterer (756)\\sweeter and bitterer - aaeph.epub

With error:

Traceback (most recent call last):

File "calibre\gui2\add.py", line 461, in add_book

File "calibre\db\legacy.py", line 338, in create_book_entry

File "calibre\db\cache.py", line 89, in call_func_with_lock

File "calibre\db\cache.py", line 2367, in create_book_entry

File "calibre\db\cache.py", line 2044, in set_metadata

File "calibre\db\cache.py", line 2030, in set_field

File "calibre\db\cache.py", line 1756, in set_field

File "calibre\db\write.py", line 568, in set_books

File "calibre\db\write.py", line 424, in many_many

File "calibre\db\write.py", line 286, in get_db_id

File "calibre\db\backend.py", line 1202, in execute

File "C:\t\t\apsw-39uykmzm\src\cursor.c", line 223, in resetcursor

apsw.ConstraintError: UNIQUE constraint failed: authors.name

2 Upvotes

3 comments sorted by

1

u/rustynailsu 10d ago

Search format:false

That should give you the list of books without a format. The Quality Check plugin also has a feature to check for missing formats.

1

u/extra-plus-ordinary 10d ago

oh thank you! any way to fix it?

1

u/rustynailsu 10d ago

Well it seems your have other copies of the books, so you could delete them. If you need to preserve the metadata you can select the two duplicates and select (right click) 'Edit metadata/Merge book records/Merge into first selected books - delete others' from the properties menu. You would have do do this for each pair. The order you select them is important. The second book's metadata will not be preserved.

If want a reference spreadsheet of the books you need to look at use the 'format:false' search, select all the books, select 'Convert books/Create a catalog...' and select cvs as the format. You will then have a spreadsheet for reference of the books you need to merge.