Plex collection sync does not appear to be working for me. When I try to sync the external Plex collections there is an error saying: "Failed To Get Collections From Plex"
Previously any changes with Plex Collections would sync. I use the Tags that it creates in Smart Collections.
Will attach logs

Testing:

  • Created a new install of Plex and ErsatzTV on a Windows PC. Using the latest versions as if 11/03/24
  • Copied 10 movies and created a new Plex movie library. Created 2 test collections. Scanned into ErsatzTV. Did not show the collections as tags
  • Ran the External Collection Plex Scanner. Still did not create the tags
  • The error message about syncing is the same as before. The logs are also the same

Other testing

  • Added a new genre to the Genre label. Quick scan did not pick up change. Full scan made the change. That is expected behaviour
  • Added a Label Called "Test Collection" to some of the Movies. Did a Full Scan and the tag showed up.
  • Removed the Test Collection Labels from Plex. Did a full scan. Test Collection Tags still there
  • Deleted the Search index and did a rescan. The Tags are still there.
  • I de-synced the Movie library in the Ersatz Plex settings and synced it again. Tags were gone.

Any other suggestions I can do to test or fix?

2024-11-03 17:00:42.125 -06:00 [WRN] Failed to get collections from Plex
Refit.ApiException: An error occured deserializing the response.
---> System.Text.Json.JsonException: The JSON value could not be converted to System.String. Path: $.MediaContainer.Metadata[0].childCount | LineNumber: 0 | BytePositionInLine: 657.
---> System.InvalidOperationException: Cannot get the value of a token type 'Number' as a string.
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ExpectedString(JsonTokenType tokenType)
at System.Text.Json.Utf8JsonReader.GetString()
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo
1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter
1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
at System.Text.Json.Serialization.JsonCollectionConverter2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
at System.Text.Json.Serialization.JsonConverter
1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter
1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo
1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter
1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.Serialization.JsonConverter
1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.ContinueDeserialize(ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo
1.DeserializeAsync(Stream utf8Json, CancellationToken cancellationToken)
at System.Net.Http.Json.HttpContentJsonExtensions.ReadFromJsonAsyncCore[T](HttpContent content, JsonSerializerOptions options, CancellationToken cancellationToken)
at Refit.SystemTextJsonContentSerializer.FromHttpContentAsync[T](HttpContent content, CancellationToken cancellationToken) in //Refit/SystemTextJsonContentSerializer.cs:line 48
at Refit.RequestBuilderImplementation.DeserializeContentAsync[T](HttpResponseMessage resp, HttpContent content, CancellationToken cancellationToken) in /
/Refit/RequestBuilderImplementation.cs:line 450
at Refit.RequestBuilderImplementation.<>c__DisplayClass15_02.<<BuildCancellableTaskFuncForMethod>b__0>d.MoveNext() in /_/Refit/RequestBuilderImplementation.cs:line 385
--- End of inner exception stack trace ---
at Refit.Implementation.Generated.ErsatzTVInfrastructurePlexIPlexServerApi.global::ErsatzTV.Infrastructure.Plex.IPlexServerApi.GetCollections(Int32 skip, Int32 take, String token) in D:\a\ErsatzTV\ErsatzTV\ErsatzTV.Infrastructure\obj\Release\net8.0\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\IPlexServerApi.g.cs:line 368
at LanguageExt.TaskExtensions.Map[T,U](Task
1 self, Func2 map)
at LanguageExt.TaskExtensions.Map[T,U](Task
1 self, Func2 map)
at ErsatzTV.Infrastructure.Plex.PlexServerApiClient.GetPagedLibraryContents[TItem](PlexConnection connection, Func
2 countItems, Func5 getItems)+MoveNext() in D:\a\ErsatzTV\ErsatzTV\ErsatzTV.Infrastructure\Plex\PlexServerApiClient.cs:line 363
at ErsatzTV.Infrastructure.Plex.PlexServerApiClient.GetPagedLibraryContents[TItem](PlexConnection connection, Func
2 countItems, Func5 getItems)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at ErsatzTV.Scanner.Core.Plex.PlexCollectionScanner.ScanCollections(PlexConnection connection, PlexServerAuthToken token, CancellationToken cancellationToken) in D:\a\ErsatzTV\ErsatzTV\ErsatzTV.Scanner\Core\Plex\PlexCollectionScanner.cs:line 42
at ErsatzTV.Scanner.Core.Plex.PlexCollectionScanner.ScanCollections(PlexConnection connection, PlexServerAuthToken token, CancellationToken cancellationToken) in D:\a\ErsatzTV\ErsatzTV\ErsatzTV.Scanner\Core\Plex\PlexCollectionScanner.cs:line 42

14 days later

Looks like this is caused by a change to the Plex Media Server. When using plex version 1.41.0.8994 and above the collection sync is broken.

I rolled back PMS to version 1.41.0.8992 and do the Plex Collection sync. Tags will show up with no error.

After the Collections synced, I made created and deleted some new collections in Plex. Updated the PMS to the latest version 9220. Doing the collection sync gives the error. But the previous tags are still attached to the Items.

Rolled back the PMS did the collection sync and tags were updated.

Tested on a larger library and the previous Smart Collections I were using are fixed. There was a couple smart collections that didn't completely update but a clearing of the search index got those going.

This work around works with Movies, TV and Other Videos.

    4 months later

    PikNPak same issue here, running on win10 and latest versions of plex server for windows and ersatztv for windows.

    i did a migration from docker to my windows tinypc last week and why tags are not showing now.

    problem seems to be ersatztv pulls the label field from plex as tag. where plex saves smart tags to the collection field in plex and thus why ersatztv shows my media with tags like overlay, etc. can we get option to change how ersatztv reads tag/fields?