Typing error when using guvectorize

I am writing a code to update parameters. The code involves a total of BURNIN+N iterations, and in each iteration, the parameters are updated. The main program code is as follows:

@jit(nopython=True)
def MCMC(Y, V, mu, omega, psi, kappa, theta):   
    for i in range(1, BURNIN + N):
        mu = update_mu(deltat, i, T, Y, V, mu, omega, psi, kappa, theta) 
        omega, psi = update_omega_psi(deltat, i, T, Y, V, mu, omega, psi, kappa, theta)
        theta = update_theta(deltat, i, T, Y, V, mu, omega, psi, kappa, theta)
        kappa = update_kappa(deltat, i, T, Y, V, mu, omega, psi, kappa, theta)
        V = update_V(i, T, Y, V, mu, omega, psi, kappa, theta)   

The code for parameter updates is as follows:

@guvectorize([(float64, int64, int64, float64[:], float64[:,:], float64[:], float64[:], float64[:], float64[:], float64[:], float64[:])], 
             '(),(),(),(n),(m,n),(m),(m),(m),(m),(m)->(m)', 
             nopython=True)      
def update_mu(deltat, i, T, Y, V, mu, omega, psi, kappa, theta, res):
    mustara = sum((omega[i-1] + psi[i-1]**2) * (Y[1:T+1] + 0.5 * V[i-1, :T] * deltat) / (omega[i-1] * V[i-1, :T]))
    mustarb = sum(psi[i-1] * (V[i-1, 1:T+1] - kappa[i-1] * theta[i-1] * deltat - (1 - kappa[i-1] * deltat) * V[i-1, :T]) / (omega[i-1] * V[i-1, :T]))
    mustar = (mustara - mustarb + (mu0 / sigma0**2)) / (deltat * sum((omega[i-1] + psi[i-1]**2) / (omega[i-1] * V[i-1, :T])) + 1 / sigma0**2)
    sigstar = np.sqrt(1 / (deltat * sum((omega[i-1] + psi[i-1]**2) / (omega[i-1] * V[i-1, :T])) + 1 / sigma0**2))
    res[i] = np.random.normal(mustar, sigstar)

For the parameter mu, the updated value from each iteration is stored in res and then reassigned to mu, which facilitates the next iteration. However, I encountered the following error:

TypingError: Cannot determine Numba type of <class 'numba.core.ir.UndefinedType'>

How to address this problem? Thanks in advance !

Someone may know the answer off the top of their head, but a minimal complete reproducer could be helpful if you can get one together.

It’s a little difficult to reason about without sample data, and especially things like the shapes of the input arrays.
I find it confusing that you pass an integer along that you use for indexing, and only do calculations for that specific index, wouldn’t that eliminate the entire benefit of guvectorize?. And especially when you don’t provide the output (res), wouldn’t that trigger the creation of a new array (of size m) every time the function is called? While it will only set that single element (i) of the output array.