kordlib/kord

ERROR dev.kord.gateway.DefaultGateway

Layzenel opened this issue · 3 comments

Update

Discord has reverted this change so as of right now you shouldn't experience this, if you do please use
the unknown-d-field-fix-SNAPSHOT version and track #923

Issue

Hi everyone. I started getting this error. The bot cannot go online

122182 [DefaultDispatcher-worker-13] ERROR dev.kord.gateway.DefaultGateway - 
java.lang.IllegalStateException: Unknown 'd' field for Op code null: {"_trace":["[\"gateway-prd-us-east1-d-cjhp\",{\"micros\":0.0}]"],"heartbeat_interval":41250}
	at dev.kord.gateway.Event$DeserializationStrategy.deserialize(Event.kt:87)
	at dev.kord.gateway.Event$DeserializationStrategy.deserialize(Event.kt:35)
	at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69)
	at kotlinx.serialization.json.Json.decodeFromString(Json.kt:107)
	at dev.kord.gateway.DefaultGateway.read(DefaultGateway.kt:189)
	at dev.kord.gateway.DefaultGateway.access$read(DefaultGateway.kt:62)
	at dev.kord.gateway.DefaultGateway$readSocket$2.emit(DefaultGateway.kt:173)
	at dev.kord.gateway.DefaultGateway$readSocket$2.emit(DefaultGateway.kt:171)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:37)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

I should add that this error happened to multiple people at the same time.
Could be a discord side problem ?

It seems like discord started sending the d field before the op field in their gateway payloads. However, our serializer for these payloads assumes that the op field always comes before the d field. Will work on a fix asap.

For now the unknown-d-field-fix-SNAPSHOT snapshot version can be used. A release will follow but I've got to sleep first.