Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
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
Old 03-06-2025, 01:37 PM   #2
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,249
Karma: 78869092
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
Looking at the log I see
Code:
\\\\bianconet\\public\\books\\ebooks\\metadata.db
.

This looks suspiciously like your library is located on a network share of some type. It's strongly advised that calibre libraries are located on LOCAL disks only.
PeterT is offline   Reply With Quote
Old 03-06-2025, 01:49 PM   #3
Lironcareto
Junior Member
Lironcareto began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Mar 2025
Device: Kindle
Got it. Thanks. I was not aware of that. Does that mean there is no way to recover my database?

Quote:
Originally Posted by PeterT View Post
Looking at the log I see
Code:
\\\\bianconet\\public\\books\\ebooks\\metadata.db
.

This looks suspiciously like your library is located on a network share of some type. It's strongly advised that calibre libraries are located on LOCAL disks only.
Lironcareto is offline   Reply With Quote
Old 03-06-2025, 02:42 PM   #4
retiredbiker
Evangelist
retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.
 
retiredbiker's Avatar
 
Posts: 443
Karma: 3367292
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Pop_Os!, Jutoh, Kobo Forma
Quote:
Originally Posted by Lironcareto View Post
Got it. Thanks. I was not aware of that. Does that mean there is no way to recover my database?
Try to copy your ebooks folder - the remote library - to your local disk. Then have Calibre make a new library on the local disk. Open that (empty) library, and try adding books from the folder you copied over.

Running a Calibre library on a remote or shared drive often works until it doesn't. It will fail eventually. Fine for a one-way backup, except google drive, never google, but that is all. It is likely the book files themselves are still OK.
retiredbiker is offline   Reply With Quote
Old 03-06-2025, 03:01 PM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 78,873
Karma: 143095300
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Lironcareto View Post
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.
The problem is most likely that some process is accessing the database on the system it's being stored on over the network. What you can try is setting the AV to ignore the directory tree your calibre libraries are stored on the other computer.
JSWolf is offline   Reply With Quote
Reply

Tags
help calibre

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Corrupted Library Dan__ Library Management 6 12-09-2024 06:14 AM
Intact Library, metadata corrupted (half library not showing) puxatudo Library Management 1 08-02-2022 09:06 AM
My library is corrupted. CCLady Calibre 23 07-28-2012 09:34 PM
903 Corrupted library Raisan PocketBook 1 04-09-2011 09:20 AM
Library corrupted rozie123 Sony Reader 1 05-26-2009 07:02 AM


All times are GMT -4. The time now is 09:25 AM.


MobileRead.com is a privately owned, operated and funded community.