Strange error requiring generated quantitites

Thanks for providing the updated model! This compiles just fine for me in single- or multithreaded mode with cmdstan 2.27.0

cmdstanr::cmdstan_model("/Users/JacobSocolar/Desktop/testmod.stan")
cmdstanr::cmdstan_model("/Users/JacobSocolar/Desktop/testmod.stan", 
                           cpp_options = list(stan_threads = TRUE))

Interestingly, I was able to reproduce your original error with rstan 2.26. Updating to 2.27 eliminated the issue. I cannot be certain whether the issue was a bug in 2.26 or whether it was a problem with my rstan installation that was fixed by re-installing.

So either there is a bug in earlier versions that is fixed in 2.27 or there’s a problem (apparently a common one) with your rstan installation. In either case, updating to the latest Stan seems to be a fix. To update to the latest rstan, do

To update to the latest Cmdstan, do

cmdstanr::install_cmdstan()