Welcome, unfortunately, you ran into a common problem when using auto-diff. In order to run forward diff on your function, it’s types need to be general enough as forward diff is implemented via a special dual number type.
Now, using zeros(len) will allocate a vector typed Float64. Instead, use zeros(eltype(x), len) to match the type of the input used during forward diff.
Further, I would suggest to pass the globals r and U1 as explicit arguments to ForDiffSL. When these should not be included in the gradient calculation, you can pass an anonymous function, i.e., ForwardDiff.gradient(x -> ForDiffSL(x, r, U1), x).