Error when merging two books & error upon copying structure

Bug #1928321 reported by ownedbycats
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Invalid
Undecided
Unassigned

Bug Description

Calibre 5.17* (x64). Tested both stable and from-source and got same results.

Attempting to merge two book records (Edit Metadata > Merge book records > Merge into first selected - delete others) gave me this error:

calibre, version 5.17.0
ERROR: Unhandled exception: <b>KeyError</b>:None

calibre 5.17 [64bit] embedded-python: True is64bit: True
Windows-10-10.0.19041 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19041')
Python 3.8.5
Windows: ('10', '10.0.19041', '', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: DeDRM (7, 2, 1) && Action Chains (1, 8, 8) && Audit Log (1, 0, 16) && Barnes & Noble (1, 2, 16) && Calibre Power Search Plugin (2, 0, 0) && Comments Cleaner (1, 3, 2) && Count Pages (1, 11, 0) && Embed Comic Metadata (1, 6, 1) && EpubCheck (0, 2, 3) && EpubMerge (2, 11, 0) && Extract ISBN (1, 5, 0) && FanFicFare (4, 2, 0) && Fantastic Fiction (1, 4, 0) && Favourites Menu (1, 0, 5) && Find Duplicates (1, 8, 5) && Generate Cover (2, 0, 2) && GetFileName (0, 1, 1) && Goodreads (1, 5, 1) && Import List (1, 5, 4) && Job Spy (1, 0, 190) && Kindle hi-res covers (0, 5, 0) && Kobo Books (1, 8, 2) && Kobo Utilities (2, 13, 2) && KoboTouchExtended (3, 4, 4) && Library Codes (1, 0, 50) && Manage Series (1, 2, 11) && Modify ePub (1, 6, 2) && Obok DeDRM (7, 2, 1) && Open With (1, 5, 13) && Overdrive Link (2, 45, 1) && Quality Check (1, 11, 2) && Reading List (1, 7, 6) && Search The Internet (1, 8, 1) && SmartEject (2, 3, 0) && Standard Ebooks (1, 0, 0) && Sum Column (0, 3, 1) && View Manager (1, 6, 0) && Walk Search History (1, 3, 2) && Overdrive Link* (2, 45, 1)
Traceback (most recent call last):
  File "calibre\gui2\actions\edit_metadata.py", line 634, in merge_books
  File "calibre\gui2\actions\edit_metadata.py", line 752, in merge_metadata
  File "calibre\db\legacy.py", line 703, in get_custom
  File "calibre\db\backend.py", line 957, in custom_field_name
KeyError: None

Most of the book metadata was copied, but the second record didn't delete.

While creating an empty test library with the same structure to attach here, I also got this error. (Note that #readorder is a series-like column.) I can't open it in Calibre without getting a similar error, and the metadata.db it generated wasn't openable in SQLiteStudio.

calibre, version 5.17.0
ERROR: Unhandled exception: <b>ValueError</b>:Duplicate custom field [readorder_index]

calibre 5.17* [64bit] embedded-python: True is64bit: True
Windows-10-10.0.19041 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19041')
Python 3.8.5
Windows: ('10', '10.0.19041', '', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: DeDRM (7, 2, 1) && Action Chains (1, 8, 8) && Audit Log (1, 0, 16) && Barnes & Noble (1, 2, 16) && Calibre Power Search Plugin (2, 0, 0) && Comments Cleaner (1, 3, 2) && Count Pages (1, 11, 0) && Embed Comic Metadata (1, 6, 1) && EpubCheck (0, 2, 3) && EpubMerge (2, 11, 0) && Extract ISBN (1, 5, 0) && FanFicFare (4, 2, 0) && Fantastic Fiction (1, 4, 0) && Favourites Menu (1, 0, 5) && Find Duplicates (1, 8, 5) && Generate Cover (2, 0, 2) && GetFileName (0, 1, 1) && Goodreads (1, 5, 1) && Import List (1, 5, 4) && Job Spy (1, 0, 190) && Kindle hi-res covers (0, 5, 0) && Kobo Books (1, 8, 2) && Kobo Utilities (2, 13, 2) && KoboTouchExtended (3, 4, 4) && Library Codes (1, 0, 50) && Manage Series (1, 2, 11) && Modify ePub (1, 6, 2) && Obok DeDRM (7, 2, 1) && Open With (1, 5, 13) && Overdrive Link (2, 45, 1) && Quality Check (1, 11, 2) && Reading List (1, 7, 6) && Search The Internet (1, 8, 1) && SmartEject (2, 3, 0) && Standard Ebooks (1, 0, 0) && Sum Column (0, 3, 1) && View Manager (1, 6, 0) && Walk Search History (1, 3, 2) && Overdrive Link* (2, 45, 1)
Traceback (most recent call last):
  File "D:\Documents\git\calibre\src\calibre\gui2\dialogs\choose_library.py", line 192, in accept
  File "D:\Documents\git\calibre\src\calibre\gui2\dialogs\choose_library.py", line 133, in perform_action
  File "D:\Documents\git\calibre\src\calibre\gui2\actions\choose_library.py", line 641, in choose_library_callback
  File "D:\Documents\git\calibre\src\calibre\gui2\ui.py", line 845, in library_moved
  File "D:\Documents\git\calibre\src\calibre\db\legacy.py", line 188, in __init__
  File "D:\Documents\git\calibre\src\calibre\db\legacy.py", line 45, in create_backend
  File "D:\Documents\git\calibre\src\calibre\db\backend.py", line 479, in __init__
  File "D:\Documents\git\calibre\src\calibre\db\backend.py", line 812, in initialize_custom_columns
  File "D:\Documents\git\calibre\src\calibre\library\field_metadata.py", line 561, in add_custom_field
ValueError: Duplicate custom field [readorder_index]

I ran Check Library and it said no errors.

description: updated
Revision history for this message
ownedbycats (ownedbycats) wrote :

If it's of any use, here's the metadata.db of a slightly older test library I had that has the same structure as my main.

description: updated
Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1928321

Works for me with your test library. Does it still fail if you run
calibre with --ignore-plugins?

 status incomplete

Changed in calibre:
status: New → Incomplete
Revision history for this message
ownedbycats (ownedbycats) wrote :

Both of the errors go away with ignore-plugins enabled. Hmm

Changed in calibre:
status: Incomplete → Invalid
Revision history for this message
ownedbycats (ownedbycats) wrote :

I've identified the plugin and posted in the thread about it.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.