I guess because I've never had to do a restore database in anger, I didn't release it preserved the book numbers (id) - I wrongly assumed they'd be re-generated.
But why was a auto-restore triggered ln the first instance, and why was another one triggered immediately after that auto-restore… ad-infinitum.
I suggest the OP does regular library checks, either manually via the GUI, or via a scheduled task that runs the
calibredb check_library command.
I check my libraries once a week, I get an occasional error - but I always know why, and it is always something
I did - usually editing a 'format file' in place with an external editor that left its dirty dishes in the sink when it crashed. Or I unpacked a CBZ to rotate some images and forgot to remove the unpacked folder after rezipping a replacement CBZ.
BR