Hello,

I’m trying to rewrite the SEIR model we used in a tutorial ([2006.02985] Bayesian workflow for disease transmission modeling in Stan) using the new ODE interfaces, including the prototype adjoint solver. I’m running into an odd bug, which is that once the code ends its warmup and starts sampling, I get an index error from Eigen:

```
Chain 1 Assertion failed: (index >= 0 && index < size()), function operator[], file stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/DenseCoeffsBase.h, line 408.
Warning: Chain 1 finished unexpectedly!
```

The generated quantities block is commented out, so I don’t know why the error systematically kicks in during the sampling phase. Note the error doesn’t occur when I use `integrate_ode_rk45`

, but when I use `ode_rk45_tol`

. I’m attaching the relevant Stan file, which contains, commented out, the original code. I can provide the R script and data to run the model, if needed.

seir_forcing_survey.stan (5.4 KB)