Having issues adding books to calibre in the past day or so.
Please see the log below.
Spoiler:
calibre, version 7.5.1
ERROR: Errors while adding: Failed to add any books, click "Show details" for more information
----------------------------------------------------------------------
Failed to add the book: The Things We Make
C:\Users\jerem\AppData\Local\Temp\calibre_1721gocx \i_pmxxxc_add_books\2\The Things We Make.epub
With error:
Traceback (most recent call last):
File "calibre\gui2\add.py", line 460, in add_book
File "calibre\db\legacy.py", line 341, in create_book_entry
File "calibre\db\cache.py", line 88, in call_func_with_lock
File "calibre\db\cache.py", line 2155, in create_book_entry
File "calibre\db\cache.py", line 1837, in set_metadata
File "calibre\db\cache.py", line 1823, in set_field
File "calibre\db\cache.py", line 1636, in set_field
File "calibre\db\write.py", line 573, in set_books
File "calibre\db\write.py", line 492, in many_many
File "calibre\db\backend.py", line 1144, in executemany
File "C:\t\t\apsw-42s16m2x\src\cursor.c", line 240, in resetcursor
apsw.ConstraintError: ConstraintError: Foreign key violation: authors is still referenced
----------------------------------------------------------------------
Failed to add the book: Edison's Ghosts
C:\Users\jerem\AppData\Local\Temp\calibre_1721gocx \i_pmxxxc_add_books\6\Edisons Ghosts.epub
With error:
Traceback (most recent call last):
File "calibre\gui2\add.py", line 460, in add_book
File "calibre\db\legacy.py", line 341, in create_book_entry
File "calibre\db\cache.py", line 88, in call_func_with_lock
File "calibre\db\cache.py", line 2155, in create_book_entry
File "calibre\db\cache.py", line 1837, in set_metadata
File "calibre\db\cache.py", line 1823, in set_field
File "calibre\db\cache.py", line 1636, in set_field
File "calibre\db\write.py", line 573, in set_books
File "calibre\db\write.py", line 492, in many_many
File "calibre\db\backend.py", line 1144, in executemany
File "C:\t\t\apsw-42s16m2x\src\cursor.c", line 240, in resetcursor
apsw.ConstraintError: ConstraintError: Foreign key violation: authors is still referenced
----------------------------------------------------------------------
Failed to add the book: The Lincoln Miracle
C:\Users\jerem\AppData\Local\Temp\calibre_1721gocx \i_pmxxxc_add_books\0\The Lincoln Miracle.epub
With error:
Traceback (most recent call last):
File "calibre\gui2\add.py", line 460, in add_book
File "calibre\db\legacy.py", line 341, in create_book_entry
File "calibre\db\cache.py", line 88, in call_func_with_lock
File "calibre\db\cache.py", line 2155, in create_book_entry
File "calibre\db\cache.py", line 1837, in set_metadata
File "calibre\db\cache.py", line 1823, in set_field
File "calibre\db\cache.py", line 1636, in set_field
File "calibre\db\write.py", line 573, in set_books
File "calibre\db\write.py", line 492, in many_many
File "calibre\db\backend.py", line 1144, in executemany
File "C:\t\t\apsw-42s16m2x\src\cursor.c", line 240, in resetcursor
apsw.ConstraintError: ConstraintError: Foreign key violation: authors is still referenced
----------------------------------------------------------------------
Failed to add the book: Is Math Real?
C:\Users\jerem\AppData\Local\Temp\calibre_1721gocx \i_pmxxxc_add_books\4\Is Math Real.epub
With error:
Traceback (most recent call last):
File "calibre\gui2\add.py", line 460, in add_book
File "calibre\db\legacy.py", line 341, in create_book_entry
File "calibre\db\cache.py", line 88, in call_func_with_lock
File "calibre\db\cache.py", line 2155, in create_book_entry
File "calibre\db\cache.py", line 1837, in set_metadata
File "calibre\db\cache.py", line 1823, in set_field
File "calibre\db\cache.py", line 1636, in set_field
File "calibre\db\write.py", line 573, in set_books
File "calibre\db\write.py", line 492, in many_many
File "calibre\db\backend.py", line 1144, in executemany
File "C:\t\t\apsw-42s16m2x\src\cursor.c", line 240, in resetcursor
apsw.ConstraintError: ConstraintError: Foreign key violation: authors is still referenced
----------------------------------------------------------------------
Failed to add the book: The Last Secret of the Secret Annex: The Untold Story of Anne Frank, Her Silent Protector, and a Family Betrayal
C:\Users\jerem\AppData\Local\Temp\calibre_1721gocx \i_pmxxxc_add_books\3\The Last Secret of the Secret Annex.epub
With error:
Traceback (most recent call last):
File "calibre\gui2\add.py", line 460, in add_book
File "calibre\db\legacy.py", line 341, in create_book_entry
File "calibre\db\cache.py", line 88, in call_func_with_lock
File "calibre\db\cache.py", line 2155, in create_book_entry
File "calibre\db\cache.py", line 1837, in set_metadata
File "calibre\db\cache.py", line 1823, in set_field
File "calibre\db\cache.py", line 1636, in set_field
File "calibre\db\write.py", line 573, in set_books
File "calibre\db\write.py", line 492, in many_many
File "calibre\db\backend.py", line 1144, in executemany
File "C:\t\t\apsw-42s16m2x\src\cursor.c", line 240, in resetcursor
apsw.ConstraintError: ConstraintError: Foreign key violation: authors is still referenced
----------------------------------------------------------------------
Failed to add the book: There Will Be Fire: Margaret Thatcher, the IRA, and Two Minutes That Changed History
C:\Users\jerem\AppData\Local\Temp\calibre_1721gocx \i_pmxxxc_add_books\5\There Will Be Fire.epub
With error:
Traceback (most recent call last):
File "calibre\gui2\add.py", line 460, in add_book
File "calibre\db\legacy.py", line 341, in create_book_entry
File "calibre\db\cache.py", line 88, in call_func_with_lock
File "calibre\db\cache.py", line 2155, in create_book_entry
File "calibre\db\cache.py", line 1837, in set_metadata
File "calibre\db\cache.py", line 1823, in set_field
File "calibre\db\cache.py", line 1636, in set_field
File "calibre\db\write.py", line 573, in set_books
File "calibre\db\write.py", line 492, in many_many
File "calibre\db\backend.py", line 1144, in executemany
File "C:\t\t\apsw-42s16m2x\src\cursor.c", line 240, in resetcursor
apsw.ConstraintError: ConstraintError: Foreign key violation: authors is still referenced
----------------------------------------------------------------------
Failed to add the book: The Essential Indian Instant Pot Cookbook: Authentic Flavors and Modern Recipes for Your Electric Pressure Cooker
C:\Users\jerem\AppData\Local\Temp\calibre_1721gocx \i_pmxxxc_add_books\1\The Essential Indian Instant Pot Cookbook.epub
With error:
Traceback (most recent call last):
File "calibre\gui2\add.py", line 460, in add_book
File "calibre\db\legacy.py", line 341, in create_book_entry
File "calibre\db\cache.py", line 88, in call_func_with_lock
File "calibre\db\cache.py", line 2155, in create_book_entry
File "calibre\db\cache.py", line 1837, in set_metadata
File "calibre\db\cache.py", line 1823, in set_field
File "calibre\db\cache.py", line 1636, in set_field
File "calibre\db\write.py", line 573, in set_books
File "calibre\db\write.py", line 492, in many_many
File "calibre\db\backend.py", line 1144, in executemany
File "C:\t\t\apsw-42s16m2x\src\cursor.c", line 240, in resetcursor
apsw.ConstraintError: ConstraintError: Foreign key violation: authors is still referenced
Last edited by theducks; 02-13-2024 at 03:15 PM.
Reason: SPOILER LOG files
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
A few months back, there was an issue with the same error message which the original poster said went away after shutting down their computer and then powering it back on. Another similar one, the OP found that they had a zombie calibre instance running which went away after a restart. In another case, Kovid Goyal suggested rebuilding the database (right clicking the library menu and choosing Library Maintenance => Restore database).
I had the same problem adding new books after upgrading to 7.5.1. I tried the recommended remedies. Rebooting the computer did not help. Restoring the Library was a disaster. I rolled everything back to when all was well from a backup, then tentatively upgraded again. Everything seems to be OK now.