kotlinx.serialization.MissingFieldException
Closed this issue · 6 comments
Hey all,
I'm running the code on my Mac (Intel on 11.2.3) via Homebrew.
When running plex-orphaned-files --base-url http://10.0.1.40:32400 --token <token> --folder-mapping /mnt/media:/Volumes/Media
, the code first searches my "4K Movies" and returns 4K Movies: /Volumes/Media/4K Movies/.DS_Store
. That makes sense. It then runs a bit and returns a list of everything in my "Movies" directory and this error:
Exception in thread "main" kotlinx.serialization.MissingFieldException: Field 'Metadata' is required for type with serial name 'com.jakewharton.plex.PlexMetadataList', but it was missing
at kotlinx.serialization.internal.PluginExceptionsKt.throwMissingFieldException(PluginExceptions.kt:20)
at com.jakewharton.plex.PlexMetadataList.<init>(plex.kt)
at com.jakewharton.plex.PlexMetadataList$$serializer.deserialize(plex.kt)
at com.jakewharton.plex.PlexMetadataList$$serializer.deserialize(plex.kt:32)
at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
at com.jakewharton.plex.PlexResponse$$serializer.deserialize(plex.kt)
at com.jakewharton.plex.PlexResponse$$serializer.deserialize(plex.kt:7)
at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
at kotlinx.serialization.json.Json.decodeFromString(Json.kt:85)
at com.jakewharton.plex.OrphanedFilesCommand$run$1.invokeSuspend(main.kt:126)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at com.jakewharton.plex.OrphanedFilesCommand.run(main.kt:89)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:171)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:16)
at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:395)
at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:392)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:410)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:435)
at com.jakewharton.plex.OrphanedFiles.main(main.kt:169)
Given that it properly runs on my 4K Movie library, I assume I'm setting up the command properly. If not, please let me know.
Also, regarding "folder-mapping", I set it up like --folder-mapping /mnt/media:/Volumes/Media
. The first path is what Plex sees and second is what I see on my Mac. Is that correct? It runs, but I wanted to be sure.
Thanks much!
So the problem is the library after "Movies". If you see output, the library has been fully parsed. This exception occurs when parsing the next library after the one you've seen. Unfortunately the order isn't based on anything that I can tell so you can't really know which is next in terms of the Plex API.
However, I just released version 1.1.0. If you try it and include the (undocumented) --debug
flag it will print the library name before the exception happens which will help me start to figure out what's wrong.
That being said, do you have any Plex libraries that have no content or no local content? It's probably that one...
Also, once you do figure out the library name, as quick workaround 1.1.0 also includes a --exclude-library
argument that you can use to skip processing it until the bug is fixed properly.
I do have a couple empty libraries used for DVR type recordings from my HD Homerun. This is what the run with --debug enabled looks like:
plex-orphaned-files --base-url http://10.0.1.40:32400 --token <token> --folder-mapping /mnt/media:/Volumes/Media --debug
Checking 4K Movies...
Found 1 orphan(s)
Checking Movies...
Found 9895 orphan(s)
Checking Movies - DVR...
Exception in thread "main" kotlinx.serialization.MissingFieldException: Field 'Metadata' is required for type with serial name 'com.jakewharton.plex.PlexMetadataList', but it was missing
at kotlinx.serialization.internal.PluginExceptionsKt.throwMissingFieldException(PluginExceptions.kt:20)
at com.jakewharton.plex.PlexMetadataList.<init>(plex.kt)
at com.jakewharton.plex.PlexMetadataList$$serializer.deserialize(plex.kt)
at com.jakewharton.plex.PlexMetadataList$$serializer.deserialize(plex.kt:114)
at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
at com.jakewharton.plex.PlexResponse$$serializer.deserialize(plex.kt)
at com.jakewharton.plex.PlexResponse$$serializer.deserialize(plex.kt:89)
at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:63)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:32)
at kotlinx.serialization.json.Json.decodeFromString(Json.kt:85)
at com.jakewharton.plex.HttpPlexApi.sectionPaths(plex.kt:61)
at com.jakewharton.plex.HttpPlexApi$sectionPaths$1.invokeSuspend(plex.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at com.jakewharton.plex.OrphanedFilesCommand.run(main.kt:109)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:171)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:16)
at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:395)
at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:392)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:410)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:435)
at com.jakewharton.plex.Main.main(main.kt:125)
This this helps! Thanks again!
Reproduced! Fix incoming...
Released 1.1.1 with the fix.
Thanks much!