System.ArgumentException: An item with the same key has already been added. Key: limit
See original GitHub issueGetting this error when trying to make a call to Client.Browse.GetCategoryPlaylists
and passing a CategoriesPlaylistsRequest
. The CategoriesPlaylistsRequest
is
{
Country = null,
Limit = 1,
Offset = null
}
Here’s the full stack trace:
System.ArgumentException: An item with the same key has already been added. Key: limit
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 SpotifyAPI.Web.RequestParams.AddQueryParam(Dictionary`2 queryParams, PropertyInfo prop, QueryParamAttribute attribute) in D:\Documents\GitHub\SpotifyAPI-NET\SpotifyAPI.Web\Models\Request\RequestParams.cs:line 149
at SpotifyAPI.Web.RequestParams.BuildQueryParams() in D:\Documents\GitHub\SpotifyAPI-NET\SpotifyAPI.Web\Models\Request\RequestParams.cs:line 76
at SpotifyAPI.Web.BrowseClient.GetCategoryPlaylists(String categoryId, CategoriesPlaylistsRequest request) in D:\Documents\GitHub\SpotifyAPI-NET\SpotifyAPI.Web\Clients\BrowseClient.cs:line 51
at MusicPlatform.Spotify.SpotifyPlatform.GetPlaylistsByGenre(Genre genre, PlaylistsGetRequest request) in C:\Users\54962\source\repos\smfields\Boogie\Boogie\MusicPlatform\Models\Implementations\Spotify\SpotifyPlatform.cs:line 141
at MorseCode.ITask.TaskAwaiterWrapper`1.MorseCode.ITask.IAwaiter<TResult>.GetResult()
at Groovy.Controllers.PlaylistController.GetPlaylistsByGenre(Platform platform, Genre genre, Nullable`1 limit, Nullable`1 offset) in C:\Users\54962\source\repos\smfields\Boogie\Boogie\Boogie\Controllers\PlaylistController.cs:line 129
at lambda_method73(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
An item with the same key has already been added
Solution is to override the property or use another name. If you share your model, we would be able to elaborate more. Share....
Read more >Error "An item with the same key has already been added"
Cause. This scenario typically occurs if an operating system image is being used to deploy cluster nodes and that image was not correctly ......
Read more >ERROR An item with the same key has already been added
The "Item with the same key" refers to the fact that the a duplicate key is found when the code tries to read...
Read more >An Item With the Same Key Has Already Been Added
An item with the same key has already been added dictionary error happens when your project includes a model with the same property...
Read more >'An item with the same key has already been added' error after ...
An error with message 'An item with the same key has already been added' is shown in the error logs after submitting a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@fjmorel @smfields Just published
6.1.0
, so feel free to switch to the nuget version!Hey, I had a similar issue today with
q
, so I’m glad to hear a fix will be out soon.