# Failure to detect repeated names with splatted keyword args

**URL:** <https://discourse.julialang.org/t/failure-to-detect-repeated-names-with-splatted-keyword-args/127675>\
**Category:** General Usage\
**Tags:** question, bug\
**Created:** [April 3, 2025, 1:29pm UTC](https://discourse.julialang.org/t/failure-to-detect-repeated-names-with-splatted-keyword-args/127675 "2025-04-03T13:29:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [April 3, 2025, 1:29pm UTC](https://discourse.julialang.org/t/failure-to-detect-repeated-names-with-splatted-keyword-args/127675/1 "2025-04-03T13:29:58Z")

</div>

Consider the following:

```julia
julia> kwargs = Dict(:a => 0)
Dict{Symbol, Int64} with 1 entry:
  :a => 0

julia> f(; a=1) = a
f (generic function with 1 method)

julia> f(; a=2, kwargs...)
0

julia> f(; a=2, a=0)
ERROR: syntax: keyword argument "a" repeated in call to "f"

```

Is that expected behavior, or should I report that as a bug? I would have expected `f(; a=2, kwargs...)` to throw the same error as `f(; a=2, a=0)`. Is there a way to avoid this foot-gun, and have Julia detect duplicate keyword arguments when there’s splatting involved? It doesn’t seem to matter whether `kwargs` is a `Dict{Symbol, Int64} ` or a `Tuple{Pair{Symbol, Int64}}`.

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [April 3, 2025, 1:42pm UTC](https://discourse.julialang.org/t/failure-to-detect-repeated-names-with-splatted-keyword-args/127675/2 "2025-04-03T13:42:25Z")

</div>

It’s [documented](https://docs.julialang.org/en/v1/manual/functions/#Keyword-Arguments):

> The nature of keyword arguments makes it possible to specify the same argument more than once. For example, in the call `plot(x, y; options..., width=2)` it is possible that the `options` structure also contains a value for `width` . In such a case the rightmost occurrence takes precedence; in this example, `width` is certain to have the value `2` . However, explicitly specifying the same keyword argument multiple times, for example `plot(x, y, width=2, width=3)` , is not allowed and results in a syntax error.
