Sonic Analysis fails due to ~259 character file path limit in Plex Transcoder

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

Hello - I have had sonic analysis problems forever and I have a hypothesis (with some help from Claude…) - see below:

On Windows, Sonic Analysis frequently fails with
“Error decoding analysis input files (exit code: 1)”
for albums containing audio files with long paths.

Based on log analysis, failures are strongly correlated with full file path length, with a hard cutoff at ~259 characters. Files below that length analyze successfully. Files above it fail immediately.

This appears consistent with a Windows command-line length limitation when Plex Transcoder is launched via cmd.exe. While Plex logs do not explicitly state “path too long,” the statistical correlation is exact and reproducible.

This issue closely resembles a Windows long-path problem you addressed in 2020 for library scanning using the \\?\ prefix, which does not appear to be consistently applied to Sonic Analysis.

I can’t see enough detail in the logs to be sure, but here is what I see:

Sonic Analysis starts Plex Transcoder

  • The process exits immediately with exit code 1

  • No stderr output is captured or logged

  • Albums are marked as failed even when most tracks succeed

There are no explicit log messages such as “path too long” or “file not found” for these failures. The only indicator is immediate process termination.

Key observations:

  • 0 files with paths longer than 259 characters succeeded

  • All files with paths ≤259 characters succeeded, regardless of artist or codec

  • The cutoff is exact at 259 characters

  • Failed attempts complete in 0–20 ms

  • Successful attempts take 200–800 ms, indicating real decode work

This strongly suggests the failure occurs before decoding begins, consistent with an input file open or command construction failure.

I also noticed that roughly 24% of attempts are duplicates, where the same physical audio file is analyzed under multiple Plex album IDs, such as standard and deluxe editions referencing the same files.

When a file is analyzed once successfully, a subsequent attempt can fail immediately because the output WAV already exists. This causes entire albums to be reported as failed even when most tracks succeeded, inflating album-level failure counts.

Plex previously addressed a Windows long-path issue during library scanning by applying the extended-length path prefix (\\?\):

https://forums.plex.tv/t/support-long-file-paths-on-windows/659568

Sonic Analysis appears to encounter the same underlying limitation. Notably, the transcoder command already uses \\?\ for FFMPEG_EXTERNAL_LIBS, but the input media file path does not use the prefix.

Suggested Fix?

Extend the existing Windows long-path handling to Sonic Analysis by:

  • Applying the \\?\ extended-length prefix to the input media file path when constructing the Plex Transcoder command

This mirrors Plex’s prior fix, avoids cmd.exe path-length limits, and requires minimal behavioral change.

Thanks in advance!!

Excellent report, thanks. I hope the devs will agree.

Hello - wondering if any devs have had a chance to look at this? It may be an easy fix.

Can you enable debug logging, reproduce the issue, and share you PMS logs?

Debug and Verbose logging were on.

sonic-analysis-path-failures.log (18.4 KB)

sonic-analysis-transcoder-failures.log (107.5 KB)

Thanks! I’ve filed an issue for investigation. Thanks again for reporting. :plexheart:

@mprachar can you please confirm that Long Paths is enabled on your Windows install?

Go to Settings > System > Advanced

Yes, of course, LongPathsEnabled is already set to 1 in the registry (HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled=1). The issue is that the transcoder invocation uses set … & “Plex Transcoder.exe” -i “” via cmd.exe — the \?\ long path prefix is used for codec/resource paths but NOT for the media file -i argument. So even with long paths enabled at the OS level, the transcoder still fails on paths >260 characters.

PMS does apply the \\?\ prefix is every scenario I have tried. I took another look at your filenames and suspect the issue may be there. Your log lists the file as

The Cranberries\Everybody Else Is Doing It, So Why Can
?Tt We (1993)\CD 04\The Cranberries - Everybody Else Is Doing It, So Why Can
?Tt We - 09 - The Icicle Melts FLAC 945 kbps 44.1kHz 16bit.flac

which has newlines and potentially a ' in it. can you please verify?

Let me dig into that specifically - stand by!

I see the mangled files, and it looks like that is what’s actually happening (the path length may have been a red herring), but I want to use a second text editor on a fresh log so I can give you at least two examples. However, I need to create fresh examples as the original logs have rotated off the server.

Hi chris_decker08, thanks for following up. I’ve dug much deeper since my original report and I need to significantly correct and update it.

The title of this thread says “259-character file path limit” — that’s wrong. I confirmed a 268-character path analyzing successfully, so path length isn’t the issue. I apologize for the misdirection.

Here’s what I found after analyzing (with a fair amount of help from Claude) 10,000+ MusicAnalysis transcoder invocations with verbose logging enabled:


Some of my music files had Unicode “smart quote” characters in filenames — the typographic right single quotation mark ' (U+2019) instead of a plain ASCII apostrophe '. Affected artists included The Cranberries (Can't), Joni Mitchell (Joni's), and Guns N’ Roses (N').

Sonic Analysis was failing on these files — the [MusicAnalysis/JobRunner] would log an invocation with what looked like the correct path, but the transcoder would immediately exit with error code -2 (ERROR_FILE_NOT_FOUND). Those failures were causing the system to get “stuck” and it wouldn’t scan other libraries (Music, TV, etc.) until I restarted PMS.

To work around this, I wrote a cleanup script that renamed the files on my NAS, replacing Unicode smart quotes with plain ASCII apostrophes. The files on disk are now fine and accessible.

So, the actual problem now is that Plex’s database kept the old entries pointing to the Unicode-apostrophe paths, AND created new entries for the ASCII-apostrophe paths. So now the database has duplicate entries for the same physical tracks — one that works (ASCII path, matches the file on disk) and one that fails (Unicode path, file was renamed so it no longer exists at that path). The good news is that the missing files fail quickly and don’t hang the scanning process, so it’s noisy but not fatal.

The numbers from my latest scan (verbose logging, full library):

  • 665 unique file paths attempted by MusicAnalysis
  • 297 succeed (exit code 0) — these are the entries with paths matching the current filenames
  • 368 fail (exit code -2) — I batch-checked every single one of these against my NAS:
    • 361 files don’t exist on disk — stale database entries pointing to the old pre-rename paths
    • 7 files exist but fail — all turned out to be corrupt or unusual audio files (0 kbps metadata, MP1/MP2 codec, empty FLAC streams) — not a Plex bug

As an example, The Cranberries album “Everybody Else Is Doing It, So Why Can’t We” has two sets of entries in the same log. CD 01 tracks (with ASCII apostrophe in the path) all succeed. CD 03 tracks (with Unicode smart quote in the path — the old filenames) all fail. Same album, same NAS share, same directory — the only difference is the apostrophe byte in the database path vs what’s on disk.

Failures are 100% deterministic per path — each path either always succeeds or always fails across all attempts. It’s not intermittent or timing-related.


So to directly answer your question, there are no newline characters or unusual apostrophes in my actual filenames. The filenames on disk are clean ASCII now. The failures are caused by stale Plex database entries that still reference the old Unicode-character paths from before I renamed the files.

I ran a full Scan + Empty Trash hoping it would clean up the orphaned entries, but it didn’t help — the stale entries persist. I suspect Plex doesn’t detect the mismatch because the old path (Can't with U+2019) and new path (Can't with ASCII ') look visually identical, even though they’re different bytes.

Open questions:

  1. Is there a way to purge these stale database entries without losing play history, star ratings, and playlists? I’d really like to avoid a full Plex Dance if possible.

  2. Separately from my self-inflicted rename issue — does MusicAnalysis actually handle Unicode characters in file paths correctly? The reason I renamed the files in the first place was that Sonic Analysis was failing on them. I can no longer reproduce that since the files are renamed, but if there IS a Unicode handling issue in the cmd.exe-based transcoder launch, it would affect anyone with MusicBrainz-sourced smart quotes in their filenames.

Happy to provide full log excerpts, the specific paths, or any additional data that would help.

I BELIVE that Unicode “smart quote” are technically not allowed in windows paths. Its likely windows has done some compatibility work for mounted drives but its possible some of our libraries assume thats paths on windows do not have this character. I will ask around to see if there is a good way to fix your library.

OK - I did get a way to get past it (hence me wasting your time chasing a ghost - sorry!) but ideally if Plex can locate and play those files it would make sense for them to also be able to be processed by Sonic Analysis.

Thannks a million for continuing to care about music in Plex :two_hearts: