Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 06-23-2018, 09:07 AM   #1
johnny_cgn
Junior Member
johnny_cgn began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jun 2018
Device: none
Adding books on cli leads to error

Since a few days i'm getting the following errors buy trying to add books with:
Code:
calibredb add /home/storage01/inbox/XXX.epub --library-path /home/storage01/calibre/my_bib/
Code:
Traceback (most recent call last):
  File "site.py", line 77, in main
  File "site-packages/calibre/db/cli/main.py", line 255, in main
  File "site-packages/calibre/db/cli/main.py", line 55, in run_cmd
  File "site-packages/calibre/db/cli/cmd_add.py", line 374, in main
  File "site-packages/calibre/db/cli/cmd_add.py", line 152, in do_add
  File "site-packages/calibre/db/cli/main.py", line 192, in run
  File "site-packages/calibre/db/cli/cmd_add.py", line 65, in implementation
  File "site-packages/calibre/db/cli/cmd_add.py", line 44, in book
  File "site-packages/calibre/db/cache.py", line 1596, in add_books
  File "site-packages/calibre/db/cache.py", line 63, in call_func_with_lock
  File "site-packages/calibre/db/cache.py", line 1566, in create_book_entry
  File "site-packages/calibre/db/cache.py", line 1284, in set_metadata
  File "site-packages/calibre/db/cache.py", line 1271, in set_field
  File "site-packages/calibre/db/cache.py", line 1092, in set_field
  File "site-packages/calibre/db/write.py", line 544, in set_books
  File "site-packages/calibre/db/write.py", line 466, in many_many
  File "site-packages/calibre/db/backend.py", line 857, in executemany
  File "src/cursor.c", line 236, in resetcursor
ConstraintError: ConstraintError: Foreign key violation: authors is still referenced
It does not seem to matter which book or what format. The error stays.

I'm running calibre 3.21 headless on Ubuntu 16.04.4 LTS.
johnny_cgn is offline   Reply With Quote
Old 06-23-2018, 11:18 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
That error indicates your database is damaged. You can use the

calibredb restore_database

command. But read the help of that command first.
kovidgoyal is offline   Reply With Quote
Old 06-24-2018, 06:42 AM   #3
johnny_cgn
Junior Member
johnny_cgn began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jun 2018
Device: none
Thank's for the quick reply.
Restoration is running now.
Any indications why the db got corrupted? Hints coud help to avoid.
johnny_cgn is offline   Reply With Quote
Old 06-24-2018, 08:47 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
There's no way to know, the typical causes are filesystem corruption caused by using the library on a flaky filesystem such as a networked filesystem, or a flash media or ina location where multiple programs try to write tothe same folders at the same time.
kovidgoyal is offline   Reply With Quote
Old 06-24-2018, 10:34 AM   #5
johnny_cgn
Junior Member
johnny_cgn began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jun 2018
Device: none
Well, since I run calibre on a vpn that is just managing this library I guess at least the fs part might be save.

Btw. after restoring the db, the error still exists. Any other ideas?
What I found out is, that the title is added to db but with no files.
johnny_cgn is offline   Reply With Quote
Old 06-24-2018, 10:02 PM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Then attach your metadata.db and the book you are trying to add and I will take a look.
kovidgoyal is offline   Reply With Quote
Old 06-25-2018, 04:10 PM   #7
johnny_cgn
Junior Member
johnny_cgn began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jun 2018
Device: none
I would be very grateful if u could do that.
Book and db
johnny_cgn is offline   Reply With Quote
Old 06-25-2018, 09:21 PM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Are you sure you rebuilt it, because that database is still damaged. For example,

Code:
echo 'select * from books_authors_link where author=29638;' | sqlite3 metadata.db                                                  *
Error: near line 1: database disk image is malformed
kovidgoyal is offline   Reply With Quote
Old 06-25-2018, 09:23 PM   #9
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You can probably fix it with

Code:
echo .dump | sqlite3 metadata.db > metadata.sql
sqlite3 fixed.db < metadata.sql
mv fixed.db metadata.db
kovidgoyal is offline   Reply With Quote
Old 06-26-2018, 03:22 AM   #10
johnny_cgn
Junior Member
johnny_cgn began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jun 2018
Device: none
In the 2nd step I'm getting the following error
Code:
Error: near line 534046: UNIQUE constraint failed: tags.name
johnny_cgn is offline   Reply With Quote
Old 06-26-2018, 03:23 AM   #11
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
That's ok, the db will stil be rebuilt.
kovidgoyal is offline   Reply With Quote
Old 06-26-2018, 04:12 AM   #12
johnny_cgn
Junior Member
johnny_cgn began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jun 2018
Device: none
Awesome. That works. Thank you
johnny_cgn is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error adding books spynumber Library Management 6 02-21-2017 07:59 PM
Adding books Error tdwish Conversion 4 01-22-2012 06:37 AM
error adding books Beau Calibre 5 11-02-2010 12:03 PM
Error adding books Gfinch Calibre 2 08-03-2008 08:36 PM


All times are GMT -4. The time now is 10:29 PM.


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