PMS "There was an unexpected error loading the dashboard"

Versions

  • Server Version: 1.15.2.793
  • Player Version: 3.83.1 Web Client (Firefox 66.0.1)
  • OS Version: Manjaro Linux 18.0.4
  • Linux Kernel: 4.20.17-1-MANJARO

The Problem

When I load the Plex dashboard on the web I get an error message stating “There was an unexpected error loading the dashboard.” Attempting to load the dashboard on the iOS and Android apps results in a screen saying the server is offline.

If I load the movies and TV shows libraries with the web client, it works fine, however, loading the TV shows library on the iOS and Android apps doesn’t work.

Web Console Logs

Looking at the web console provides a bit more information

[Connections] DoA-Server is unavailable at https://172-17-0-1.98b1b85c31084f1a868b781ee7588a2d.plex.direct:32400/media/providers (Status 0)
XML Parsing Error: no root element found
Location: https://10-0-0-111.98b1b85c31084f1a868b781ee7588a2d.plex.direct:32400/player/proxy/poll?deviceClass=pc&protocolVersion=1&protocolCapabilities=timeline%2Cplayback%2Cnavigation%2Cmirror%2Cplayqueues&timeout=1&X-Plex-Product=Plex%20Web&X-Plex-Version=3.83.1&X-Plex-Client-Identifier=5n4onzf88goosakzpb8dfftq&X-Plex-Platform=Firefox&X-Plex-Platform-Version=66.0&X-Plex-Sync-Version=2&X-Plex-Device=OSX&X-Plex-Device-Name=Firefox&X-Plex-Device-Screen-Resolution=1920x1103%2C1920x1200&X-Plex-Token=[redacted]&X-Plex-Language=en
Line Number 1, Column 1:

PMS Logs

Full PMS logs: Plex Media Server.log (197.3 KB)

Interesting bits:

Mar 24, 2019 18:12:29.584 [0x7fd103fff700] ERROR - Caught exception trying to stream file: /usr/lib/plexmediaserver/Resources/Plug-ins-782228f99/WebClient.bundle/Contents/Resources/favicon.ico: write: Broken pipe
Mar 24, 2019 18:19:37.320 [0x7fd1477fe700] ERROR - [PlexRelay] kex protocol error: type 7 seq 11
Mar 24, 2019 18:19:38.415 [0x7fd0eaffd700] ERROR - SQLITE3:(nil), 11, database corruption at line 65066 of [bf8c1b2b7a]
Mar 24, 2019 18:19:38.415 [0x7fd0eaffd700] ERROR - SQLITE3:(nil), 11, statement aborts at 76: [select media_items.id as 'media_items_id', media_items.library_section_id as 'media_items_library_section_id', media_items.section_location_id as 'media_items_section_location_id', med
Mar 24, 2019 18:19:38.415 [0x7fd0eaffd700] ERROR - Soci Exception handled: sqlite3_statement_backend::loadRS: database disk image is malformed

My Attempted Solutions

  1. Restarting Plex
    • No change
  2. Restarting server
    • No change
  3. Reverting to a 3 day old database backup
    • No change
  4. Attempting a recovery of the apparently corrupt database per the instruction here
    • Without modifying the file at all "PRAGMA integrity_check" returns Error: no such collation sequence: naturalsort
    • After DROPping the naturalsort index:
      *** in database main ***
      Page 79988: btreeInitPage() returns error code 11
      Error: database disk image is malformed
      
    • I attempted to run a repair
      • The dump.sql file is 80mb (about what I’d expect given the .db file’s 85mb)
      • When I try to rebuild the com.plexapp.plugins.library.db, I end up with a .db file with 0 bits

I’m not really sure where to go from here.

Next step.

  1. Uninstall 1.15.2
  2. Revert database to a previous backup (again)
  3. Reboot
  4. Install 1.14.1
  5. Refresh all the metadata, empty trash and clean bundles

I tried installing a few different 1.14.x versions, but they all failed to start, not even printing to the Plex logs.

I had been running PMS 1.15.1.707-1 until the 23rd, so I tried that version too, which does start, but gives the same error on the dashboard. Upon trying to empty the trash on the TV shows library, I got an error “There was a problem emptying the trash” which seems to be related to these new lines in the logfile

Mar 25, 2019 20:57:08.377 [0x7f64317fa700] ERROR - SQLITE3:(nil), 11, database corruption at line 64757 of [bf8c1b2b7a]
Mar 25, 2019 20:57:08.377 [0x7f64317fa700] ERROR - SQLITE3:(nil), 11, database corruption at line 64798 of [bf8c1b2b7a]
Mar 25, 2019 20:57:08.377 [0x7f64317fa700] ERROR - SQLITE3:(nil), 11, statement aborts at 10: [delete from media_stream_settings where media_stream_id in (select media_streams.id from media_streams where media_item_id=?)] database disk image is malformed
Mar 25, 2019 20:57:08.377 [0x7f64317fa700] ERROR - Exception inside transaction (inside=1) (../Library/MediaItem.cpp:765): sqlite3_statement_backend::loadOne: database disk image is malformed
Mar 25, 2019 20:57:08.377 [0x7f64317fa700] ERROR - Soci Exception handled: sqlite3_statement_backend::loadOne: database disk image is malformed

Edit:
I think I might have found the specific TV episode that is causing the trash empty to fail. It’s an episode that I recently added, which has had 4 different versions over the last couple of days. There is only file on disk for it now, but Plex seems to think the other 3 are still there. When I try to “delete” them manually through the Plex UI, I get an error saying " There was a problem deleting this item." The Plex logs show this:

Mar 25, 2019 21:04:22.442 [0x7f63c67fc700] ERROR - SQLITE3:(nil), 11, database corruption at line 64757 of [bf8c1b2b7a]
Mar 25, 2019 21:04:22.442 [0x7f63c67fc700] ERROR - SQLITE3:(nil), 11, database corruption at line 64798 of [bf8c1b2b7a]
Mar 25, 2019 21:04:22.442 [0x7f63c67fc700] ERROR - SQLITE3:(nil), 11, statement aborts at 21: [select media_items.id as 'media_items_id', media_items.library_section_id as 'media_items_library_section_id', media_items.section_location_id as 'media_items_section_location_id', med
Mar 25, 2019 21:04:22.442 [0x7f63c67fc700] ERROR - Error in MediaItem::Find - sqlite3_statement_backend::loadRS: database disk image is malformed

I also just noticed that if I try and load the page for that specific episode, it fails to load saying “There was an unexpected error loading this item” and logs the following:

Mar 25, 2019 21:05:42.847 [0x7f64067fc700] ERROR - SQLITE3:(nil), 11, database corruption at line 65066 of [bf8c1b2b7a]
Mar 25, 2019 21:05:42.847 [0x7f64067fc700] ERROR - SQLITE3:(nil), 11, statement aborts at 76: [select media_items.id as 'media_items_id', media_items.library_section_id as 'media_items_library_section_id', media_items.section_location_id as 'media_items_section_location_id', med
Mar 25, 2019 21:05:42.847 [0x7f64067fc700] ERROR - Soci Exception handled: sqlite3_statement_backend::loadRS: database disk image is malformed

It seems that there is also another episode in another show that is behaving similarly, where 4/5 files are no longer on disk, but Plex thinks they are, and the page for the episode fails to load.

Edit 2:
There’s at least 6 episodes like this.

Do the next step, we will salvage what we can after the fact

  1. Save the previous metadata (the watched history is most important here)
sudo sh
cd  /var/lib/plexmediaserver
mv Library Library.keep
  1. Start PMS
  2. Create a new server with a TEST friendly name
  3. Do all you want to do to bring everything back
  4. When done, Stop PMS
  5. Transfer the old server instance (ID) information to this new one.
sudo cp -p "/var/lib/plexmediaserver/Library.keep/Application Support/Plex Media Server/Preferences.xml"    "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server"
# now verify Preferences.xml is still owned by plex:plex
  1. Start the server and verify everything comes back as it once was, less the watched history.

Let me know how this progresses and we will address the history next if you still want it.

What version of PMS should I be running for this?

Start with 1.14.1 as it has the most using it and is otherwise stable.

So I ended up taking a look at the SQL file as well as the SQLite database and after a lot of experimentation, realized the the SQL dump file ended in a ROLLBACK command for some reason. Removing that command and replacing it with COMMIT actually allowed for the creation of a database from that SQL file, which Plex seems to think is fine.

Is there any reason you can think of that I shouldn’t be running this database?

So Plex’s database got corrupted again. This time it looks like it happened when I replaced the movie file for Glass.

Now, every time I search for something, I get this error in the logs:

SQLITE3:(nil), 11, database corruption at line 68035 of [bf8c1b2b7a]
SQLITE3:(nil), 11, statement aborts at 3: [SELECT idx, start_block, leaves_end_block, end_block, root FROM 'main'.'fts4_metadata_titles_segdir' WHERE level BETWEEN ? AND ?ORDER BY level DESC, idx ASC] database disk image is malf
SQLITE3:(nil), 11, statement aborts at 11: [select distinct metadata_items.id from metadata_items  join fts4_metadata_titles on metadata_items.id=fts4_metadata_titles.rowid  join metadata_item_accounts on metadata_item_accounts.
Soci Exception handled: sqlite3_statement_backend::loadRS: database disk image is malformed

It seems like there’s an issue with Plex losing track of deleted media, maybe where some reference to the original file gets removed while others remain.

Having similar problems. The Discovery-All Libraries is not loading on any device. Same SQLITE errors. If I scroll through the Discovery items, All seem to work except for TV Shows. That then gives me the “There was an unexpected error loading the dashboard”

How can we fix this error?

Pannos

I’ve continued to experience this and similar database corruptions constantly with Plex (but not with Jellyfin or any of the 20 other services I run on my server). It seems to happen at least once per week, if not more. It got to the point where I decided that I would write a script to automate the database repair operation.

This seems to be a really horrible “fix”, so I’d exhaust any other option that isn’t completely starting from scratch first.

Also, the script isn’t intended to be run on Windows, so it would require some modifications to possibly work.

To reiterate, I don’t believe that my script actually fixes the underlying issues causing the database corruption, but at the very least, it seems to hide the symptoms. I’m actively exploring other movie hosting solutions since Plex seems disinterested in fixing the problem.

Your 0 byte error is because the transaction is rolled back at the end of the dump.sql file.
Open the dump.sql in notepad++ or something similar
goto the last line in the file and change ROLLBACK; to COMMIT;
rerun the command to recreate the database file.

As for the recurring corruption, i get my corruption from unescaped characters in the file names of the media. One character that appears bad is the ‘+’ while the db wont die immediately and the media loads to plex. it appears to be a background routine that populates the metadata table. maybe run statistics or something.

Hope this helps.

Regarding the ROLLBACK, I figured out the same thing. That’s part of what my script in the post above does.

That’s very interesting about the + character causing database corruption. Is that something that you read about being an issue with Plex, or did you discover that yourself?
I do about 70 files with a + in the name.

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