Library Scanner only scans 1st folder in libraries and ignores rest

Server Version#: Version 1.16.2.1297
Player Version#:

I noticed this a couple of days ago after the previous beta release and confirmed it is still true after today’s update.

I noticed the library scanner wasn’t picking up some of my new files. After a decent amount of troubleshooting, I realized it was only scanning the first folder no matter where it was located (local vs NAS).

I was able to replicate by creating a new library and adding a single folder. It scanned everything correctly. I added a second folder that was located on the same drive and it completely ignored it. This was true for Movie and TV libraries in my testing.

Anyone using libraries with a single folder would never notice this, but anyone like me that use multiple folders across multiple drives would notice right away.

Figured out what it was:

The previous beta upgrade corrupted the DB. After digging into the scanner log I found the following error:

sqlite3_statement_backend::loadRS: database disk image is malformed

When googling I found this post from 2015:

In which don.alcombright stated:

" So this happened to me a few weeks ago going from one beta to another in unRAID. The fix had nothing to do with my library. I deleted the below two files (with Plex off) and on restart Plex regenerates these:

com.plexapp.plugins.library.db-wal

com.plexapp.plugins.library.db-shm

Your library is not stored in either of these but in this: com.plexapp.plugins.library.db"

It forced me to go find these files on the Mac and found them here (hidden directory which you will need to unhide):

/Library/Application Support/Plex Media Server/Plug-in Support/Databases/

I did not find the 2 files referenced in the 2015 post but I did find the db and backups taken before each upgrade:

com.plexapp.plugins.library.db
com.plexapp.plugins.library.db-2019-06-28

So I stopped Plex renamed the current db file and made a copy of the backup and renamed it as if it was the current db file. I restarted Plex and everything started working again and everything scanning correctly.

I hope this helps anyone who runs into this issue in the future. I should start optimizing my db and backing it up on a regular basis and recommend that for everyone.