Follow up on my earlier message.
After posting I went searching the thread with fewer keywords and found some messages from last October. One of davidfor's messages mentioned a similar case where compressing the database might fix the problem (and if not, I'd be no worse off).
After running "Compress device database" I found that the fatal error I was receiving after plugging in had changed.
Code:
calibre, version 2.15.0 (win32, isfrozen: True)
Failed to backup device database: Failed: Backing up Kobo device database
wrong # of entries in index analytics_events_timestamp
wrong # of entries in index sqlite_autoindex_AnalyticsEvents_1
Traceback (most recent call last):
File "site-packages\calibre\gui2\device.py", line 87, in run
File "calibre_plugins.koboutilities.jobs", line 186, in do_device_database_backup
Exception:
wrong # of entries in index analytics_events_timestamp
wrong # of entries in index sqlite_autoindex_AnalyticsEvents_1
Similar to what PeterT just found (although KoboDesktop is not the culprit in this case).
Bad indexes don't worry me as much as (potentially) missing data. I can probably rebuild the indexes if I can remember the SQL syntax...