Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception #911

Closed
Rattlyy opened this issue Jan 16, 2024 · 7 comments · Fixed by #912
Closed

Exception #911

Rattlyy opened this issue Jan 16, 2024 · 7 comments · Fixed by #912
Assignees
Labels
bug Something isn't working

Comments

@Rattlyy
Copy link

Rattlyy commented Jan 16, 2024

Don't really know which event fires this.

[DefaultDispatcher-worker-5] ERROR dev.kord.gateway.DefaultGateway - 
kotlinx.serialization.json.internal.JsonDecodingException: String literal for key 'primitive' should be quoted.
Use 'isLenient = true' in 'Json {}' builder to accept non-compliant JSON.
JSON input: 1024
        at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:24)
        at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:32)
        at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeTaggedString(TreeJsonDecoder.kt:144)
        at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeTaggedString(TreeJsonDecoder.kt:36)
        at kotlinx.serialization.internal.TaggedDecoder.decodeString(Tagged.kt:231)
        at dev.kord.common.DiscordBitSet$Serializer.deserialize(DiscordBitSet.kt:119)
        at dev.kord.common.DiscordBitSet$Serializer.deserialize(DiscordBitSet.kt:116)
        at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:61)
        at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeSerializableValue(TreeJsonDecoder.kt:52)
        at dev.kord.common.entity.Permissions$Serializer.deserialize(Permission.kt:733)
        at dev.kord.common.entity.Permissions$Serializer.deserialize(Permission.kt:721)
        at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:61)
        at kotlinx.serialization.json.internal.AbstractJsonTreeDecoder.decodeSerializableValue(TreeJsonDecoder.kt:52)
        at kotlinx.serialization.json.internal.TreeJsonDecoderKt.readJson(TreeJsonDecoder.kt:25)
        at kotlinx.serialization.json.Json.decodeFromJsonElement(Json.kt:127)
        at dev.kord.common.entity.AuditLogChange$Serializer.deserialize(AuditLog.kt:214)
        at dev.kord.common.entity.AuditLogChange$Serializer.deserialize(AuditLog.kt:189)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:168)
        at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:538)
        at kotlinx.serialization.internal.CollectionLikeSerializer.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.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69)
        at dev.kord.common.entity.optional.Optional$OptionalSerializer.deserialize(Optional.kt:177)
        at dev.kord.common.entity.optional.Optional$OptionalSerializer.deserialize(Optional.kt:155)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:168)
        at dev.kord.common.entity.DiscordAuditLogEntry$$serializer.deserialize(AuditLog.kt:105)
        at dev.kord.common.entity.DiscordAuditLogEntry$$serializer.deserialize(AuditLog.kt:105)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:69)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableElement(StreamingJsonDecoder.kt:168)
        at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:538)
        at dev.kord.gateway.Event$DeserializationStrategy.getByDispatchEvent(Event.kt:175)
        at dev.kord.gateway.Event$DeserializationStrategy.deserialize(Event.kt:67)
        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)
@lukellmann
Copy link
Member

It is probably this: discord/discord-api-docs#6616
Also see this conversation in the Kord Discord server.

I think I know how to fix this, will try do it later today.

@lukellmann lukellmann self-assigned this Jan 16, 2024
@Rattlyy
Copy link
Author

Rattlyy commented Jan 16, 2024

Okay. I managed to reproduce it while editing a channel's permissions, so it does make sense.

lukellmann added a commit that referenced this issue Jan 16, 2024
Also throw NumberFormatException from DiscordBitSet factory function
for large negative numbers while I'm here.

Fixes #911
@lukellmann
Copy link
Member

Okay. I managed to reproduce it while editing a channel's permissions, so it does make sense.

Makes sense, that will trigger an audit log entry create event that contains the JSON Kord can't parse right now.

@lukellmann
Copy link
Member

When the build for #912 succeeds you can try out bit-set-fixes-SNAPSHOT to test if this fixes your issue.

@lukellmann
Copy link
Member

When the build for #912 succeeds you can try out bit-set-fixes-SNAPSHOT to test if this fixes your issue.

also @Tmpod

@DRSchlaubi DRSchlaubi added the bug Something isn't working label Jan 16, 2024
lukellmann added a commit that referenced this issue Jan 18, 2024
Also throw NumberFormatException from DiscordBitSet factory function
for large negative numbers while I'm here.

Fixes #911
@lukellmann
Copy link
Member

The fix is merged and will be included in the next release. If needed I could also do a 0.13.1 release just containing this fix - let me know.

@Tmpod
Copy link
Contributor

Tmpod commented Jan 19, 2024

I completely missed your ping a couple of days ago, sorry!
Thanks for the fix, will try it soon (maybe tomorrow).

lukellmann added a commit that referenced this issue Jan 19, 2024
Also throw NumberFormatException from DiscordBitSet factory function
for large negative numbers while I'm here.

Fixes #911

(cherry picked from commit a6b5963)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants