I agree with lupemba. There is almost always surprises with a Vector{Real}. I don’t see exactly what is the problem in your code, but note that a Vector{Real} can contain both Float64 and Int, as well as other things:
julia> v = Real[2.34, 0, pi]
3-element Vector{Real}:
2.34
0
π = 3.1415926535897...
julia> typeof.(v)
3-element Vector{DataType}:
Float64
Int64
Irrational{:π}
I guess somehow an Int has sneaked into one of your vectors.
I realize that you use Real to accommodate the Dual type of ForwardDiff, but it is also generally a bad idea to have structs with abstract data types like AbstractVector/AbstractArray. The reason is mainly that it is slow.
If you need temporary storage inside your objective function which is compatible with ForwardDiff, there are tools for it in Home · PreallocationTools.jl.