View Single Post
Old 03-06-2025, 01:08 PM   #1
Lironcareto
Junior Member
Lironcareto began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Mar 2025
Device: Kindle
Corrupted library

Hi. I've been using Calibre for more than 10 years without any single problem. Currently I'm using v.7.26

Today I opened it, like any other day, and I found an error saying that the library was corrupted and asking if I wanted to open a new library. I searched over the internet and I found a reply by Kovid suggesting to do a repair with calibredb repair_database -r. So I did, and it ended with "Restoring database succeeded", but the problem persisted.

So, I opened Calibre and created a new library, and tried to switch to the old library. When I do that I get a different error, saying:

UnicodeDecodeError: uft8 codec can't decode byte 0x8c in position 117: invalid start byte

When I try to switch to the library a second time, then the error changes, and says that the library is corrupted and asks if I want Calibre to try and restore. So I say yes, it goes through all the books, with the blue progress bar... and after finishing, I get a message saying that the restore failed. When I click Show details, it starts like

calibre, version 7.26.0
ERROR: Failed to repair library: Restoring database failed, click "Show details" to see details

Traceback (most recent call last):
File "calibre\db\restore.py", line 325, in replace_db
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'path_to_db\\metadata.db' -> 'path_to_db\\metadata_pre_restore.db'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "calibre\db\restore.py", line 156, in run
File "calibre\db\restore.py", line 330, in replace_db
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'path_to_library\\metadata.db'

I checked and there is no other process accessing metadata.db. Actually, when I try to do anything with the file, like moving, or renaming, Windows says that calibre.exe has the file open.

In addition to those errors, there is an entry for each book like this
calibre, version 7.26.0
ERROR: Failed to repair library: Restoring database failed, click "Show details" to see details

Traceback (most recent call last):
File "calibre\db\restore.py", line 325, in replace_db
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: '\\\\bianconet\\public\\books\\ebooks\\metadata.db ' -> '\\\\bianconet\\public\\books\\ebooks\\metadata_pr e_restore.db'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "calibre\db\restore.py", line 156, in run
File "calibre\db\restore.py", line 330, in replace_db
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: '\\\\bianconet\\public\\books\\ebooks\\metadata.db '


-------------
Failed to restore: Francisco de Quevedo y Villegas/La vida del Buscon (313)
Traceback (most recent call last):
File "calibre\db\restore.py", line 302, in restore_books
File "calibre\db\cache.py", line 85, in call_func_with_lock
File "calibre\db\cache.py", line 2930, in restore_book
File "calibre\db\cache.py", line 2150, in create_book_entry
File "calibre\db\backend.py", line 1145, in execute
File "C:\t\t\apsw-42s16m2x\src\cursor.c", line 240, in resetcursor
apsw.ConstraintError: ConstraintError: UNIQUE constraint failed: books.id

Am I hopeless?
Lironcareto is offline   Reply With Quote