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

Kord fails to deserialize a GuildCreate event with a unavailable guild #627

Open
MrPowerGamerBR opened this issue Jun 22, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@MrPowerGamerBR
Copy link
Contributor

MrPowerGamerBR commented Jun 22, 2022

Caused by: kotlinx.serialization.MissingFieldException: Fields [name, icon, owner_id, region, afk_channel_id, afk_timeout, verification_level, default_message_notifications, explicit_content_filter, roles, emojis, features, mfa_level, application_id, system_channel_id, system_channel_flags, rules_channel_id, vanity_url_code, description, banner, premium_tier, preferred_locale, public_updates_channel_id, nsfw_level, premium_progress_bar_enabled] are required for type with serial name 'dev.kord.common.entity.DiscordGuild', but they were missing at path: $.d
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:40)
        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:111)
        at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:537)
        at dev.kord.gateway.Event$DeserializationStrategy.getByDispatchEvent(Event.kt:167)
        at dev.kord.gateway.Event$DeserializationStrategy.deserialize(Event.kt:80)
        at dev.kord.gateway.Event$DeserializationStrategy.deserialize(Event.kt:48)
        at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:38)
        ... 9 common frames omitted

Event Payload:

{"d": {"id": "989200553198375033", "unavailable": true}, "s": 27007, "t": "GUILD_CREATE", "op": 0}
@HopeBaron
Copy link
Member

Seems like a partial guild object -- will look into it

@HopeBaron HopeBaron added the bug Something isn't working label Aug 9, 2022
@HopeBaron
Copy link
Member

A fix should be deployed on branch #627 -- will keep you up to date

@lukellmann
Copy link
Member

This might also be relevant for discord's docs. This doesn't suggest that you can receive a guild with only those two fields. Maybe you could create an issue there too.

@MrPowerGamerBR
Copy link
Contributor Author

MrPowerGamerBR commented Aug 31, 2022

@lukellmann while it isn't documented in the Guild Create section for some reason, they do provide an example of the object here: https://discord.com/developers/docs/resources/guild#unavailable-guild-object-example-unavailable-guild

There is also a PR about it here: discord/discord-api-docs#5122

@lukellmann
Copy link
Member

Yeah, I'm aware of the unavailable guild object (it is already modeled in kord and used in the ready event).
But good to see that there is already an issue and PR about this 👍

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.

3 participants