Persistent ghost parser error in Stan model

I updated Rstudio and suddenly a model that ran with no issue before is throwing non-sensical parser errors. I have tried running other models that have also previously ran and they are all throwing the same parser error:
"Error in stanc(file = file, model_code = model_code, model_name = model_name, :

Syntax error in ‘string’, line 53, column 4 to column 5, parsing error:

Expected end of file after end of generated quantities block."

See code chunk below where line 53 is “for(i in 1:N){”:

generated quantities {
vector[N] nuY;
for(i in 1:N){
nuY[i] = bernoulli_rng(inv_logit((beta + u[2, year[i]]) * fl[i] + u[1, year[i]] + alpha));

I have tried reverting to a previous version of Rstudio but the error is persistent. On some models the error shows up on a different line number where there is absolutely no code.

Solved the error. It’s weird because before today the above code was perfectly acceptable to rstan. What rstan didn’t like was nesting inv_logit() inside bernoulli_rng() . Historically I have used bernoulli_rng(inv_logit()) instead of bernoulli_logit_rng() because Rstudio doesn’t seem to recognize the latter as a statistical distribution and fails to make the text blue in colour. The crazy part is that this throws a syntax error for a different line of code than where the error was, so it was super difficult to figure out what was wrong.