Skip to content

On startup throws An item with the same key has already been added. Key: 0 #2128

@BlackLotusLV

Description

@BlackLotusLV

Summary

Nightly 2390 on startup it throws this error

[2024:10:24 22:09:56 ERR] [   |            ] Event handler exception for event DSharpPlus.EventArgs.ClientStartedEventArgs thrown from System.Threading.Tasks.Task lambda_method2(System.Runtime.CompilerServices.Closure, DSharpPlus.DiscordClient, DSharpPlus.EventArgs.ClientStartedEventArgs, System.IServiceProvider) (defined in null).
System.ArgumentException: An item with the same key has already been added. Key: 0
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.MapApplicationCommands(IReadOnlyList`1 applicationCommands)
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.RegisterSlashCommandsAsync(CommandsExtension extension)
   at DSharpPlus.Commands.Processors.SlashCommands.SlashCommandProcessor.ConfigureAsync(CommandsExtension extension)
   at DSharpPlus.Commands.CommandsExtension.RefreshAsync()
   at DSharpPlus.Commands.RefreshEventHandler.HandleEventAsync(DiscordClient sender, ClientStartedEventArgs eventArgs)
   at DSharpPlus.Clients.DefaultEventDispatcher.<>c__DisplayClass5_0`1.<<DispatchAsync>b__0>d.MoveNext()

What version of the library are you using?

v5.0.0-nightly (make sure you are using the latest nightly!)

What .NET version are you using? Make sure to use the latest patch release for your major version.

.NET 8.0

Operating System

Win 11

Reproduction Steps

Not entirely sure what causes this. Aki said - "that sounds like a bug with DebugGuildId i hypothesized would happen..."
Be on nightly 2390
My config https://github.com/BlackLotusLV/TheCrewCommunity/blob/master/TheCrewCommunity/ServiceConfiguration.cs#L130

Trace Logs

No response

Exceptions or other error messages

No response

Anything else you'd like to share

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    commandsFor issues related to DSharpPlus.Commands

    Type

    Effort

    None yet

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions