`convert` is ambiguous

Surprising for me (Julia 1.6.3):

julia> a = [nothing]
1-element Vector{Nothing}:
 nothing

julia> a[1] = (0,)
ERROR: MethodError: convert(::Type{Union{}}, ::Tuple{Int64}) is ambiguous. Candidates:
  convert(::Type{T}, x::Tuple{Vararg{Any, N}}) where {N, T<:Tuple} in Base at essentials.jl:316
  convert(::Type{Union{}}, x) in Base at essentials.jl:203
  convert(::Type{T}, arg) where T<:VecElement in Base at baseext.jl:8
Possible fix, define
  convert(::Type{Union{}}, ::Tuple{Vararg{Any, N}}) where N

Is this expected? How can I fix it?

Nevermind. This works

julia> a = Union{Tuple{Int},Nothing}[nothing]
1-element Vector{Union{Nothing, Tuple{Int64}}}:
 nothing

julia> a[1] = (0,)
(0,)
3 Likes