Check The Docs
Verify Issue Source
Check your intents
Description
When fetching Discord messages that contain a message component with type: 20, the library throws a JsonSerializationException with the message "Unknown component type value '20' while deserializing message component". This causes the entire message deserialization to fail, preventing applications from processing messages that contain this unknown component type.
Version
3.18.0, 3.18.0-nightly.20251128.696
Working Version
No response
Logs
System.AggregateException: One or more errors occurred. (Unknown component type value '20' while deserializing message component)
---> Newtonsoft.Json.JsonSerializationException: Unknown component type value '20' while deserializing message component
at Discord.Net.Converters.MessageComponentConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Discord.Net.Converters.ArrayConverter`1.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Discord.Net.Converters.OptionalConverter`1.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
at Discord.API.DiscordRestApiClient.DeserializeJson[T](Stream jsonStream)
at Discord.API.DiscordRestApiClient.SendAsync[TResponse](String method, String endpoint, BucketId bucketId, ClientBucketType clientBucket, RequestOptions options)
at Discord.Rest.ChannelHelper.<>c__DisplayClass10_0.<<GetMessagesAsync>b__0>d.MoveNext()
Sample
The current ComponentType enum in Discord.Net.Core defines values up to 19 (FileUpload):
- ActionRow = 1
- Button = 2
- SelectMenu = 3
- TextInput = 4
- UserSelect = 5
- RoleSelect = 6
- MentionableSelect = 7
- ChannelSelect = 8
- Section = 9
- TextDisplay = 10
- Thumbnail = 11
- MediaGallery = 12
- File = 13
- Separator = 14
- Container = 17
- Label = 18
- FileUpload = 19
ComponentType 20 is not defined, but Discord is sending it in some messages.
Packages
3rd Party Packages
Discord.Net Dependencies:
- Newtonsoft.Json Version 13.0.4
- System.Linq.AsyncEnumerable Version 10.0.0
Application Packages (for context):
Environment
- Discord.Net Versions: 3.18.0, 3.18.0-nightly.20251128.696
- .NET Version: .NET 8.0
- Operating System: Ubuntu 22.04
Check The Docs
Verify Issue Source
Check your intents
Description
When fetching Discord messages that contain a message component with
type: 20, the library throws aJsonSerializationExceptionwith the message "Unknown component type value '20' while deserializing message component". This causes the entire message deserialization to fail, preventing applications from processing messages that contain this unknown component type.Version
3.18.0, 3.18.0-nightly.20251128.696
Working Version
No response
Logs
Sample
The current
ComponentTypeenum inDiscord.Net.Coredefines values up to 19 (FileUpload):ComponentType 20 is not defined, but Discord is sending it in some messages.
Packages
3rd Party Packages
Discord.Net Dependencies:
Application Packages (for context):
Environment