Stan files crash Rstudio

Hi,
I'm running some Stan models (using rstan). The sheer fact of opening the .stan file prompts Rstudio to throw this message in the console

sh: 1: : not found
sh: 1: 0: not found
sh: 1: : not found
sh: 1: 0: not found

After that I cannot run stan models. For example

rstan::stan_model('stan_code_2HMM.stan')
sh: 1: : not found
sh: 1: 0: not found
Error in stanc(file = file, model_code = model_code, model_name = model_name,  : 
  0
Failed to convert stanc.js argument 'code'!
It had type 'object' instead of 'string'.
In addition: Warning message:
In system(paste(CPP, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
  error in running command

I can run the r-file wrapper and thus estimate the stan model either in vscode or using Rscript command console. Hence why I think it's a problem with Rstudio, and possibly with the interpreter and syntax highlighter (but not sure).

I'm using Rstudio 2024.12.0 Build 467. I'm pretty sure I didn't have this issue before (but could well be a combo problem with rstan).

Any idea (eg how to turn off some stuff for that not to happen)?

Thanks
Gianni

So far I cannot reproduce this problem. I'm able to open stan files in 2024.12.0 without getting the errors you are seeing. I also tried 2024.12.1 and latest build of 2025.04.0.

Note that 2024.12.1 just released with a bunch of bug fixes, so you could grab that and see if it makes any difference (there were fixes related to autocompletion, but nothing specific to stan that I'm aware of offhand).

Otherwise, if you can't get it working, I suggest you open an issue in the github repo with as many details on how to reproduce the problem as you can provide: open an issue

Hi Gary,
thanks for the quick response.
I‘ll follow your advice. I have the same problem on two separate machines (Debian 12 and Ubuntu 2024). I even tried with a nightly build 2025) of Rstudio with no effect.

Cheers
Gianni

Since I still can't reproduce this, your best bet is to open an issue. Then if others are experiencing this they may add details that help us figure out how to trigger this (and fix it).