View Single Post
Old 08-25-2014, 02:39 PM   #25
DaltonST
Deviser
DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.
 
DaltonST's Avatar
 
Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
ABC Job Failure Caused by Corrupt metadata.db & How to Repair It

This is a "note to file" type of post regarding advice about resolving an ABC issue that may occur if your Calibre metadata.db ever becomes corrupted. The ABC job will fail with messages similar to those shown below, although the specific custom_column_n table will likely be different(i.e., not 4, but whatever was the next number available when you configured the custom column author_book_count).

To resolve the job failure as shown below, Quick Switch to the Calibre library that has the issue shown below, and then from the menu click: Library > Library Maintenance > Check Library.

Calibre will do a Vacuum of your metadata.db in order to defragment it. It will then (if you allow it, which you should) compare what your metadata.db says should be in your library directory structure, and vice-versa. Let it fix all problems it finds, and then rerun Library > Library Maintenance > Check Library until there are no more errors to fix.

It is a very good idea to run Library > Library Maintenance > Check Library at least once a month or so just on general principles.


The particular Calibre library for which the job shown below failed had duplicate book/author entries in its metadata.db and metadata for books that did not exist in the directory structure. Library > Library Maintenance > Check Library repaired it.

-------------------------------------------------------------------
Example: Job Failure Caused by Corrupt metadata.db

-------------------------------------------------------------------
Starting job: Author Book Count
================================================== ==
Job: "Author Book Count" failed with error:
Traceback (most recent call last):
File "site-packages/calibre/gui2/threaded_jobs.py", line 83, in start_work
File "calibre_plugins.author_book_count.main", line 57, in Get_all_author_book_counts
File "calibre_plugins.author_book_count.main", line 81, in Refresh_author_book_count
File "calibre_plugins.author_book_count.main", line 232, in Refresh_books_custom_column_x
IntegrityError: Foreign key violation: value not in custom_column_4
Called with args: (, ) {u'notifications': , u'abort': , u'log': }
-------------------------------------------------------------------
DaltonST is offline   Reply With Quote