JetBrains-Discord-Integration icon indicating copy to clipboard operation
JetBrains-Discord-Integration copied to clipboard

kotlinx.serialization.MissingFieldException

Open erictelkkala opened this issue 2 years ago • 1 comments

  • IntelliJ 2022.3.1 Ultimate
  • Build #IU-223.8214.52
  • Runtime version: 17.0.5+1-b653.23 amd64
  • VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Caught error when decoding packet (op: 1, length: 301) 

kotlinx.serialization.MissingFieldException: Field 'bot' is required for type with serial name 'dev.cbyrne.kdiscordipc.data.user.User', but it was missing
	at kotlinx.serialization.internal.PluginExceptionsKt.throwMissingFieldException(PluginExceptions.kt:20)
	at dev.cbyrne.kdiscordipc.data.user.User.<init>(User.kt:7)
	at dev.cbyrne.kdiscordipc.data.user.User$$serializer.deserialize(User.kt:7)
	at dev.cbyrne.kdiscordipc.data.user.User$$serializer.deserialize(User.kt:7)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
	at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeSerializableValue(TreeJsonDecoder.kt:51)
	at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableValue(Tagged.kt:206)
	at kotlinx.serialization.internal.TaggedDecoder$decodeSerializableElement$1.invoke(Tagged.kt:279)
	at kotlinx.serialization.internal.TaggedDecoder.tagBlock(Tagged.kt:296)
	at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableElement(Tagged.kt:279)
	at dev.cbyrne.kdiscordipc.core.event.data.ReadyEventData$$serializer.deserialize(ReadyEventData.kt:7)
	at dev.cbyrne.kdiscordipc.core.event.data.ReadyEventData$$serializer.deserialize(ReadyEventData.kt:7)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
	at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeSerializableValue(TreeJsonDecoder.kt:51)
	at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableValue(Tagged.kt:206)
	at kotlinx.serialization.internal.TaggedDecoder$decodeSerializableElement$1.invoke(Tagged.kt:279)
	at kotlinx.serialization.internal.TaggedDecoder.tagBlock(Tagged.kt:296)
	at kotlinx.serialization.internal.TaggedDecoder.decodeSerializableElement(Tagged.kt:279)
	at dev.cbyrne.kdiscordipc.core.packet.inbound.impl.DispatchEventPacket$Ready$$serializer.deserialize(DispatchEventPacket.kt:17)
	at dev.cbyrne.kdiscordipc.core.packet.inbound.impl.DispatchEventPacket$Ready$$serializer.deserialize(DispatchEventPacket.kt:17)
	at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
	at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeSerializableValue(TreeJsonDecoder.kt:51)
	at kotlinx.serialization.json.internal.TreeJsonDecoderKt.readJson(TreeJsonDecoder.kt:24)
	at kotlinx.serialization.json.Json.decodeFromJsonElement(Json.kt:119)
	at kotlinx.serialization.json.JsonContentPolymorphicSerializer.deserialize(JsonContentPolymorphicSerializer.kt:93)
	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 dev.cbyrne.kdiscordipc.core.packet.pipeline.ByteToMessageDecoder.decode(ByteToMessageDecoder.kt:23)
	at dev.cbyrne.kdiscordipc.core.socket.handler.SocketHandler$events$1.invokeSuspend(SocketHandler.kt:36)
	at dev.cbyrne.kdiscordipc.core.socket.handler.SocketHandler$events$1.invoke(SocketHandler.kt)
	at dev.cbyrne.kdiscordipc.core.socket.handler.SocketHandler$events$1.invoke(SocketHandler.kt)
	at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
	at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
	at kotlinx.coroutines.flow.internal.ChannelFlowOperatorImpl.flowCollect(ChannelFlow.kt:195)
	at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo$suspendImpl(ChannelFlow.kt:157)
	at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo(ChannelFlow.kt)
	at kotlinx.coroutines.flow.internal.ChannelFlow$collectToFun$1.invokeSuspend(ChannelFlow.kt:60)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

It just gives an exception, but all the functionalities work fine

erictelkkala avatar Jan 09 '23 11:01 erictelkkala

Does that happen consistently? Just to check, what is your discord version? (You can check that by opening discord settings and going all the way down):

image

dnbln avatar Feb 05 '23 12:02 dnbln