Short summary of the problem:
Getting error running rstan or saving stan files - not finding an End of file
I’m on a MacBook Pro with the M1 Max Chip. Due to earlier issues, I’m running:
rstan version 2.26.6 (Stan version 2.26.1)
I’m trying to edit a stan file that works fine. But even with a small change in the code - like changing the defined range of a variable - I get a parsing error: “Expected end of file after end of generated quantities block.” Sometimes a small change will get a “syntactically correct” message when saving but still get this error when running the file.
it sounds like you’ve got one too many close brackets somewhere in your code.
the parser is going through the GQ block and hits the closing “}”, it can’t handle anything other than trailing whitespace after that, so when it gets more Stan code, it throws an error.
Maybe so. There don’t seem to be now. But the RStudio session seems to be sticky on errors. Even when they are corrected I still get the same error messages.
This is unfortunately a known error with the new rstan 2.26, where if the parser encounters an error, then all future models (even if correct) will also error. The only solution at this point is to restart the R session.