Skip to content

[Bug]: Message update methods throw an exception when flags is set to MessageFlags.None #3132

@d4n3436

Description

@d4n3436

Check The Docs

  • I double checked the docs and couldn't find any useful information.

Verify Issue Source

  • I verified the issue was caused by Discord.Net.

Check your intents

  • I double checked that I have the required intents.

Description

IUserMessage.ModifyAsync, IDiscordInteraction.ModifyOriginalResponseAsync and IComponentInteraction.UpdateAsync throw an exception when the Flags property is set to MessageFlags.None.
This only occurs when modifying a message containing components V2, and I assume this is a bug because it doesn't happen when I pass attachments.

Version

3.18.0-nightly.20250516.531

Working Version

No response

Logs

Discord.Net.HttpException: The server responded with error 50035: Invalid Form Body
Inner Errors:
UNION_TYPE_CHOICES: Value of field "type" must be one of (1,).
   at Discord.Net.Queue.RequestBucket.SendAsync(RestRequest request)
   at Discord.Net.Queue.RequestQueue.SendAsync(RestRequest request)
   at Discord.API.DiscordRestApiClient.SendInternalAsync(String method, String endpoint, RestRequest request)
   at Discord.API.DiscordRestApiClient.SendJsonAsync[TResponse](String method, String endpoint, Object payload, BucketId bucketId, ClientBucketType clientBucket, RequestOptions options)
   at Discord.WebSocket.SocketInteraction.ModifyOriginalResponseAsync(Action`1 func, RequestOptions options)
   at Discord.WebSocket.SocketInteraction.Discord.IDiscordInteraction.ModifyOriginalResponseAsync(Action`1 func, RequestOptions options)
   at ExampleBot.Modules.PaginatorModule.ComponentAsync(String query) in C:\Users\d4n\source\repos\d4n3436\Fergun.Interactive\ExampleBot\Modules\PaginatorModule.cs:line 148
   at Discord.Interactions.Builders.ModuleClassBuilder.<>c__DisplayClass11_0.<<CreateCallback>g__ExecuteCallback|1>d.MoveNext()
   --- End of inner exception stack trace ---

Sample

var components = new ComponentBuilderV2()
    .WithContainer(new ContainerBuilder()
        .WithTextDisplay("Test")
        .WithAccentColor(Color.Blue))
    .Build();

await Context.Interaction.RespondAsync(components: components);

var newComponents = new ComponentBuilderV2()
    .WithContainer(new ContainerBuilder()
        .WithTextDisplay("Modified")
        .WithAccentColor(Color.Blue))
    .Build();

await Context.Interaction.ModifyOriginalResponseAsync(x => // Throws exception
{
    x.Flags = MessageFlags.None;
    x.Components = newComponents;
});

Packages

(None)

Environment

OS: Windows 11
SDK: .NET 8

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions