jakobkmar/pacmc

Exception when calling "pacmc search better"

Opened this issue · 6 comments

When using "better" as the search term, SerializationException is raised saying that ProjectType does not contain element with name 'resourcepack'. This bug exists in both main and release branches.

Full error message:

Searching with the given query 'better'
kotlinx.serialization.SerializationException: net.axay.pacmc.repoapi.modrinth.model.ServerRenderedProject.ProjectType does not contain element with name 'resourcepack'
at kotlinx.serialization.json.internal.JsonNamesMapKt.getJsonNameIndexOrThrow(JsonNamesMap.kt:63)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeEnum(StreamingJsonDecoder.kt:265)
at net.axay.pacmc.repoapi.modrinth.model.ServerRenderedProject$ProjectType$$serializer.deserialize(ServerRenderedProject.kt:69)
at net.axay.pacmc.repoapi.modrinth.model.ServerRenderedProject$ProjectType$$serializer.deserialize(ServerRenderedProject.kt:69)
at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
at net.axay.pacmc.repoapi.modrinth.model.ProjectResult$$serializer.deserialize(ProjectResult.kt:10)
at net.axay.pacmc.repoapi.modrinth.model.ProjectResult$$serializer.deserialize(ProjectResult.kt:10)
at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:535)
at kotlinx.serialization.internal.ListLikeSerializer.readElement(CollectionSerializers.kt:80)
at kotlinx.serialization.internal.AbstractCollectionSerializer.readElement$default(CollectionSerializers.kt:51)
at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:36)
at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)
at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
at net.axay.pacmc.repoapi.modrinth.model.SearchResults$$serializer.deserialize(SearchResults.kt:8)
at net.axay.pacmc.repoapi.modrinth.model.SearchResults$$serializer.deserialize(SearchResults.kt:8)
at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
at kotlinx.serialization.internal.NullableSerializer.deserialize(NullableSerializer.kt:30)
at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
at kotlinx.serialization.json.Json.decodeFromString(Json.kt:100)
at net.axay.pacmc.repoapi.modrinth.ModrinthApi.searchProjects(ModrinthApi.kt:107)
at net.axay.pacmc.repoapi.modrinth.ModrinthApi$searchProjects$1.invokeSuspend(ModrinthApi.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

That's because of modrinth added plugins and resourcepacks which are currently unknown to pacmc. The same error happened in #67

i will fix it quick

should be fixed with #71

I noticed this today with running pacmc search sodium, but interestingly not with pacmc search phosphor.

> pacmc search ConnectedTexturesMod

Searching with the given query 'ConnectedTexturesMod'
kotlinx.serialization.SerializationException: net.axay.pacmc.repoapi.modrinth.model.ServerRenderedProject.ProjectType does not contain element with name 'resourcepack'
        at kotlinx.serialization.json.internal.JsonNamesMapKt.getJsonNameIndexOrThrow(JsonNamesMap.kt:63)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeEnum(StreamingJsonDecoder.kt:265)
        at net.axay.pacmc.repoapi.modrinth.model.ServerRenderedProject$ProjectType$$serializer.deserialize(ServerRenderedProject.kt:69)
        at net.axay.pacmc.repoapi.modrinth.model.ServerRenderedProject$ProjectType$$serializer.deserialize(ServerRenderedProject.kt:69)
        at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
        at net.axay.pacmc.repoapi.modrinth.model.ProjectResult$$serializer.deserialize(ProjectResult.kt:10)
        at net.axay.pacmc.repoapi.modrinth.model.ProjectResult$$serializer.deserialize(ProjectResult.kt:10)
        at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
        at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:535)
        at kotlinx.serialization.internal.ListLikeSerializer.readElement(CollectionSerializers.kt:80)
        at kotlinx.serialization.internal.AbstractCollectionSerializer.readElement$default(CollectionSerializers.kt:51)
        at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:36)
        at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)
        at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
        at net.axay.pacmc.repoapi.modrinth.model.SearchResults$$serializer.deserialize(SearchResults.kt:8)
        at net.axay.pacmc.repoapi.modrinth.model.SearchResults$$serializer.deserialize(SearchResults.kt:8)
        at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
        at kotlinx.serialization.internal.NullableSerializer.deserialize(NullableSerializer.kt:30)
        at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
        at kotlinx.serialization.json.Json.decodeFromString(Json.kt:100)
        at net.axay.pacmc.repoapi.modrinth.ModrinthApi.searchProjects(ModrinthApi.kt:107)
        at net.axay.pacmc.repoapi.modrinth.ModrinthApi$searchProjects$1.invokeSuspend(ModrinthApi.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

@WordlessEcho thank you for providing the excpetion

This project is currently not being actively worked on (due to lack of time on my side).

Since the official Modrinth App provides some similiar functionality, I think it is a good replacement for the time being https://modrinth.com/app (it also has a CLI).

I'll add a notice to the readme of this repository.