I asked Chuck this question on another post but wanted to get more eyes on it since it was for an unrelated issue.
I recently trashed my Plex install and had to create my libraries and add everything back.
Even though I corrected their dates with the touch command (some of my files had a timestamp from the year 2038?!?!) I wanted to edit the database to move the stubborn files out of the ‘recently added’ section. Is this the correct way?
/usr/lib/plexmediaserver/Plex\ SQLite “/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db”
…after Plex SQLite has the database open and I’m in the command prompt, type:
UPDATE metadata_items (hit enter)
SET added_at = originally_available_at (hit enter)
WHERE originally_available_at IS NOT NULL; (hit enter)
Those steps correct? Any downside to doing a bulk change like that?
So back to my problem with this thread… if Plex has incorrect data for recently added movies/shows and the Plex dance isn’t working, how do I correct this?
I think the last time I ran into this, here’s how I fixed it:
Stopped the server
Changed my system clock back a year
Started Plex and added my stuff back then after Plex recognized it, stopped the server
Changed the clock to what it should be then started the server and added stuff I wanted to be correctly in the ‘recently added’ section.
I’ve never had problems where file creation date was incorrect.
If you turn your system clock back one year, then everything will be in the future won’t it and PMS won’t matter anyway because it deals with Epoch Time (time since 1.1.1970)
Either way, I’ll need to create a program to play with the filesystem
I know it sounds crazy but I found that tip somewhere, years ago. I used it to push stuff down the ‘recently added’ list. Because when Plex would scan it in, it would scan it in while my clock was set to 2020. Then, I’d fix clock and add more stuff and it was added with 2025 (as an exampled) and things went back to normal. But thanks for testing that.
I’ll go ahead and give my bomb tossing idea a try tomorrow. If it fails in a major way, I’ll put a copy of the database right back and we can try of another way to move the stuff that seems to be permanently stuck in recently added.
Would it be hard to do something like this in Plex….. somewhere in the settings, maybe when editing a library?…. give us the ability to do something like……
….for TV shows, have a menu somewhere when editing a library that will take the air date from the agent and write it into the ‘added_at’ field
… and for Movies, 'take the agent info for when the movie was released and copy that over to ‘added_at’
…. then, force some sort of refresh of the database. Or give us the ability to schedule it as a nightly maintenance task so things stay in sync with the media in our libraries?
Just thinking out loud. Ok, I’ll give my Plex SQLite command a shot around 6am tomorrow……..fingers crossed.
UPDATE: LISTEN TO CHUCK, I DON’T RECOMMEND MANUALLY EDITING THE DATABASE!
I thought I was in the clear but after I was done, I decided to download the server logs just now to look for anything weird and saw page upon page upon page of SQLite errors:
Aug 21, 2025 08:13:51.627 [140594580310840] INFO - [Req#1649e/Database optimization/com.plexapp.plugins.library.db] SQLITE3:0x80000001, 17, statement aborts at 61: [select * from metadata_items limit 1] database schema has changed
Since that was an epic failure, in a future update, it would be nice if we could manually adjust stuff like that from within the admin console of Plex itself and not have to do the dance or risk damaging the database by using Plex SQLite.
I’ve seen more than one post asking for that ability over the years…. do you know if it’s on on the roadmap? Or since Plex Inc is moving more towards providing their own content to clients and not giving as much love to the PMS side, is asking for that ability a lost cause?
I got my server back to normal operations by restoring a backup of the database.
I can’t speak for engineering on any plans for how they run the internals.
If you think about it, “Added At” is when you added the media to the server.
You want to be able to arbitrarily change that? That’s a big ask.
You know the root cause was file creation date being in the future.
If anything, I can see where Engineering might be willing to put in checks and prevent “Future” media from being added by clamping it to be “Now”.
Something like this.
// Get current time
time_now = gettimeofday(....);
// Make cretain to not add media in the future
if (file_creation_time > time_now) file_creation_time = time_now;
// Now add the media to the DB.
...
...
I will ask (write a request) about it and see what they say.
It might be easy enough to put in such a check and clamp.
You’re 100% correct. The files that I had problems with were all years in the future. And thinking back to past problems like this, it was ALWAYS issues with files from the future.
Yes, a sanity check like you suggested would be the perfect solution!
They would specifically like to know (list please, with details) of what happens / what is not correct when the files “from the future” are added to PMS
If you can show any files / directory listings / PMS info (any supporting information generated by PMS) that would be helpful
The log message snippet you gave isn’t an unexpected error. That’s a normal message during startup, I think as part of the automatic database schema check-and-migrate process Plex does to support database upgrades when Plex itself is updated.
I formatted my drive and put a fresh copy of Debian 13 on there and installed Plex and tried restoring my database. I had tons of problems so decided to just remove Plex and start from scratch. I did: apt remove plex and apt purge plex then reinstalled it and proceeded to add my libraries back. First up, was TV shows (what I didn’t know is that SOME of the shows I was adding back, had dates in the future like this…. notice the year 2038):
… after Plex ingested them, they were added to ‘Recently Added in TV Shows’. I quickly noticed that as more and more episodes were being pulled in from different shows, Landman would still be at the front of the list. If I’d go into the TV Shows library and sort by ‘Episodes > Date Added’…… Landman would permanently be shown as “added a few seconds ago” and newer stuff would be added behind it. I even had Plex ingest a brand new show with a brand new episode and when it was added to the library, it was added BEHIND Landman.
The only way I was able to fix this (not sure if the touch command was REALLY needed but it’s what I did…)
Move all the Landman episodes out of their folder
touch -d “1 year ago” all the Landman S01 episodes
After that, I had Plex scan the TV show library/clean bundles/optimize (so it would see them as removed)
I stopped the service
I set my system clock back a year
Started plex
Added Landman back and scanned the library and waited for Plex to see them (they didn’t show up in ‘recently added’)
Stopped plex
Correct the system clock
Reboot
When my system came back up, I then started to add newer TV shows and they were correctly being populated in ‘recently added’ and Landman was finally nowhere in sight.
BEFORE this thread derails, I’ve removed some posts.
I have submitted the request to Engineering for PMS to handle those cases where the the file date/time stamp is in the future and how it impacts Recently Added.