I think this is the same issue as here: Error in mul!(c,a,b) if size(b) = (n,1) - #8 by lmiq
tl;dr is that LsqFit’s functions accept anything, but they only actually work with vector input. You probably want to call vec(p0)
before passing it in, and make sure your function En
accepts that.