Plex Media Scanner CLI tool issue: Always Abort

Server Version#: 1.21.0.3616
Player Version#: N/A

I moved a LOT of media around, consolidating a lot of different folders. Now a lot of my media is not showing up in Plex. From what I have read, if a Scan was running when the content was moved (which is likely), then the Library is not detecting the changes right.

When I run a scan in the UI, I get nothing new. So I take one movie and move it out, then back in, and that one movie gets detected. That proves the theory that the Scanner just isn’t seeing the files as new.

So, I read up on and found the Plex Media Scanner CLI tool. However, when I try to run it (in a jail on TrueNAS / FreeNAS), it always just outputs “Abort”. Adding --verbose doesn’t give me anything additional. I tried exporting the environment variables I use in my rc script, but get the same thing.

Any insights as to how to figure out what’s going on here? Or another way to force a full rescan of the library folder?

Thanks!

Running as ~plex?
Are the necessary environment variables set?

First guess is that PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR needs to be exported before running the command.

https://support.plex.tv/articles/201242707-plex-media-scanner-via-command-line/

If that’s not it, please share what’s in the environment (env), the exact command being run, and the output.

1 Like

Separate from the CLI tool Abort issue - what type media Library & what agent? The Plex Movie scanner/agent doesn’t typically need these “Plex Dance” / hokey-pokey workarounds.

Running a Scan from the Web UI or the command line should find the same files. I haven’t had different results from one vs. the other.

I’m curious - if you look at your Library and filter for Duplicates, perhaps some of the media has been incorrectly matched and is stacked with other shows.

It might also be helpful to share your current file naming and directory structure.

@Volts - First things first…user error. I forgot that my jail’s disk layout is quite old and at this point non-standard. Once I remembered that and exported the CORRECT home directory info, the command was able to successfully run the “–list” action.

Now, I ran a scan (-s -x -v) and it didn’t find anything to add. I tried adding “-c 1” for the library section, no difference. What’s stranger though, when I add “-d /mnt/path/to/folder”, it scans a different folder based on the output it’s giving.

My folder structure is simple, and all mounted RO. /mnt/DVD Library 5/Movies for Movies , and /mnt/DVD Library 5/TV Shows for Shows. There are some additional folders for things like Home Movies, Exercise, and more, but they are all similar. Each Plex library maps to one of those folders.

So, I run:
/usr/local/share/plexmediaserver-plexpass/Plex\ Media\ Scanner -s -d /mnt/DVD\ Library\ 5/Movies/ -v

and it is reporting on content in the TV library…which is strange.

When I run it by collection ID, it runs not finding the TV shows, but isn’t fixing the issue of content not in there:

/usr/local/share/plexmediaserver-plexpass/Plex\ Media\ Scanner -s -x -v -c 1
(no output at all).

So playing around to get more information, I ran a tree output (-t -c 1) and got this in the results (snipped)

* Die Hard [1988]
    * Poster: metadata://posters/tv.plex.agents.movie_d365d4800b0431a1ca772bd2d877ae95980951ab
    * Art: metadata://art/tv.plex.agents.movie_d85d8a6dd918e091fc0a0f79cee57581097ec467
      * Part: /mnt/DVD Library 5/Movies/Die Hard 1 (1988).mkv
      * Part: /mnt/DVD Library 5/Movies/Die Hard 2.m4v
        * Subtitles: (vobsub, eng)
      * Part: /mnt/DVD Library 5/Movies/Die Hard 3.m4v
        * Subtitles: (vobsub, eng)

That is one of my problem movies. The library is showing Die Hard, but not Die Hard 2 or Die Hard 3. It looks like somehow those files got associated with the first movie (probably because of the name format being different) when the files moved and were rescanned.

I don’t see any way of fixing this other then moving those conflicting files out of the way, then putting them back (maybe with a different name) to ensure they are processed on their own.

I don’t think that -d works unless you also specify the -c to which it belongs, but I’m not sure. There are combinations of the Scanner options that interact, and I don’t understand them all. :slight_smile:

That has absolutely matched & stacked the files as Die Hard (1988). Another way to identify media with files like this is to filter the view to show Duplicates.

https://support.plex.tv/articles/202393718-how-do-i-find-duplicate-or-merged-content/

You should be able to select them in Plex and choose Split Apart. You can then Match or Fix Match and search for the correct movies. They’ll stay split afterwards.

For file naming, I would encourage you to name them accurately after the movies, and to include the years. That should help with matching in the future.

../Movies/Die Hard (1988).mkv
../Movies/Die Hard 2 (1990).m4v
../Movies/Die Hard with a Vengeance (1995).m4v

There are some excellent utilities to help with file naming and directory structure, if you are interested. FileBot is most frequently recommended. I also like TinyMediaManager.

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