# MethodError: reduce\_empty is ambiguous

**URL:** <https://discourse.julialang.org/t/methoderror-reduce-empty-is-ambiguous/29527>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [October 5, 2019, 7:04pm UTC](https://discourse.julialang.org/t/methoderror-reduce-empty-is-ambiguous/29527 "2019-10-05T19:04:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![leiteiro](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@leiteiro](https://discourse.julialang.org/u/leiteiro)\
**Post date:** [October 5, 2019, 7:04pm UTC](https://discourse.julialang.org/t/methoderror-reduce-empty-is-ambiguous/29527/1 "2019-10-05T19:04:08Z")

</div>

(Julia 1.2.0)

I have a function which generates a list of integer lists, some of which might be empty. For example  
L = [Int, [1]], so L is a 2-element Array{Array{Int64,1},1}.

This is how I want things to work. In reality, this happens: The function returns an

```
Array{T,1} where T[Union{}[], [1]]

```

and as a result summing the parts of L (which is expected to give [0, 1]) fails with a MethodError:

```
reduce_empty(::typeof(Base.add_sum), ::Type{Union{ }}) is ambiguous.

```

What I need is the compiler to recognize that the parts of L are of type Array{Int64,1} and not of  
T[Union{}, [1]].

What is the probable cause and cure for this ambiguity?

---

<div class="post-metadata">

**Author:** ![longemen3000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/longemen3000/32/7298_2.png) [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Post date:** [October 6, 2019, 6:45am UTC](https://discourse.julialang.org/t/methoderror-reduce-empty-is-ambiguous/29527/2 "2019-10-06T06:45:54Z")

</div>

can you post an example array to work with or the function that generates one of those arrays?
