Database/Index Corruption & database disk image is malformed

Server Version#: 1.24.0.4921 running on Mac OS 11.5.1

Recently I’ve started to get notifications that my PMS database is corrupted. When I look in PMS logs I see the below. I tried following the steps documented here Repair a Corrupted Database | Plex Support but there was no noticeable change. When I check for corruption the return is OK. When I attempt to recover the database the output file is very small and only contains the following lines (regardless if an output file or not is specified).

PRAGMA foreign_keys=OFF;
BEGIN;
PRAGMA writable_schema = on;
PRAGMA writable_schema = off;
COMMIT;

Aug 09, 2021 11:09:34.610 [0x7000099e8000] ERROR - SQLITE3:(nil), 779, index corruption at line 91877 of [1b256d97b5]
Aug 09, 2021 11:09:34.610 [0x7000099e8000] ERROR - SQLITE3:(nil), 779, statement aborts at 66: [update metadata_item_settings set account_id=:metadata_item_settings_account_id,guid=:metadata_item_settings_guid,rating=:metadata_item_settings_rating,view_offset=:metadata_item_setti
Aug 09, 2021 11:09:34.610 [0x7000099e8000] ERROR - Exception inside transaction (inside=1) (/data/jenkins/server/1782715324/Library/MetadataItem.cpp:11736): sqlite3_statement_backend::loadOne: database disk image is malformed
Aug 09, 2021 11:09:34.610 [0x7000099e8000] ERROR - Soci Exception handled: sqlite3_statement_backend::loadOne: database disk image is malformed
Aug 09, 2021 11:09:37.986 [0x70000a3a1000] WARN - QueryParser: Invalid field 'subtype' found, ignoring.
Aug 09, 2021 11:09:37.986 [0x70000a3a1000] WARN - QueryParser: Invalid field 'smart' found, ignoring.
Aug 09, 2021 11:09:42.253 [0x7000099e8000] ERROR - SQLITE3:(nil), 779, index corruption at line 91877 of [1b256d97b5]
Aug 09, 2021 11:09:42.253 [0x7000099e8000] ERROR - SQLITE3:(nil), 779, statement aborts at 66: [update metadata_item_settings set account_id=:metadata_item_settings_account_id,guid=:metadata_item_settings_guid,rating=:metadata_item_settings_rating,view_offset=:metadata_item_setti
Aug 09, 2021 11:09:42.253 [0x7000099e8000] ERROR - Exception inside transaction (inside=1) (/data/jenkins/server/1782715324/Library/MetadataItem.cpp:11736): sqlite3_statement_backend::loadOne: database disk image is malformed
Aug 09, 2021 11:09:42.255 [0x7000099e8000] ERROR - Soci Exception handled: sqlite3_statement_backend::loadOne: database disk image is malformed
Aug 09, 2021 11:09:54.597 [0x7000099e8000] WARN - QueryParser: Invalid field 'subtype' found, ignoring.
Aug 09, 2021 11:09:54.597 [0x7000099e8000] WARN - QueryParser: Invalid field 'smart' found, ignoring.
Aug 09, 2021 11:10:01.880 [0x7000099e8000] WARN - QueryParser: Invalid field 'subtype' found, ignoring.
Aug 09, 2021 11:10:01.880 [0x7000099e8000] WARN - QueryParser: Invalid field 'smart' found, ignoring.
Aug 09, 2021 11:10:03.882 [0x7000099e8000] WARN - QueryParser: Invalid field 'subtype' found, ignoring.
Aug 09, 2021 11:10:03.882 [0x7000099e8000] WARN - QueryParser: Invalid field 'smart' found, ignoring.
Aug 09, 2021 11:10:10.775 [0x700009e00000] ERROR - SQLITE3:(nil), 779, index corruption at line 91877 of [1b256d97b5]
Aug 09, 2021 11:10:10.775 [0x700009e00000] ERROR - SQLITE3:(nil), 779, statement aborts at 66: [update metadata_item_settings set account_id=:metadata_item_settings_account_id,guid=:metadata_item_settings_guid,rating=:metadata_item_settings_rating,view_offset=:metadata_item_setti
Aug 09, 2021 11:10:10.775 [0x700009e00000] ERROR - Exception inside transaction (inside=1) (/data/jenkins/server/1782715324/Library/MetadataItem.cpp:11736): sqlite3_statement_backend::loadOne: database disk image is malformed

Plex Media Server.1.log (3.7 KB)
Plex Media Server.2.log (9.6 KB)
Plex Media Server.3.log (13.4 KB)
Plex Media Server.4.log (4.9 KB)
Plex Media Server.5.log (3.5 KB)
Plex Media Server.log (2.7 KB)

It’s possible that the current database is so badly damaged that it cannot be repaired. If that’s the case, you may need to try to restore a backup of your database; by default, Plex Media Server will create a backup every three days. This article describes the restoration process:

Dependent upon how recently you noticed this problem, you may need to restore an older database.

My last database backup was from the end of June so I was able to restore using that. Is there a way I can clear the logs out?

Via Plex? I don’t believe so. I think you’ll just have to delete them from:
/Users/username/Library/Logs/Plex Media Server/

That’s fine, I can delete them through there. Wanted to get fresh logs after the database restore and take a look. Thanks for your help!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.