In this case, you are indexing with kpa[1] while kpa is assumed to be a scalar. modelingtoolkitize works by calling your function with a type Num that redefines operations to record an unevaluated symbolic representation. Since no return type was specified in the registration, it was assumed to be a scalar Num. You can specify a return type to sort this out, but you also have to specify that you want the symbolic scalar lookup to accept a vector:
lookup_arr(d, v) = d[v]
@register_symbolic lookup_arr(d, v)::Vector{Num}
lookup_val(a, v) = a[v]
@register_symbolic lookup_val(a::Vector{Num}, v)
function ...
...
kpa = lookup_arr(d, v)
kpa2 = lookup_val(u, kpa[1])
...
end
You could also just hide all the indexing behind one function with something like
lookup_val(u, d, v) = u[d[v]]
@register_symbolic lookup_val(u::Vector{Num}, d, v)