Syntax errors not showing on save even though Check on Save is checked

Ever since I updated to 2.19.1 and 3.6.1 I am not getting the syntax errors on save even when Check on Save is selected. I do get a message when there are no syntax errors saying syntactically correct. Is this an option I haven’t found, a bug, a feature???

Actually this may even be a newer problem that started when I migrated to a new Macbook Pro.

Your question is a bit vague. I’m guessing that “2.19.1” refers to Stan 2.19.1 and that “3.6.1” refers to R 3.6.1, but that only helps so much. Does “Check on Save” refer to this?:

Yes to all. It might be a bigger problem. I also don’t get any error message when a chain bombs out. I just get this unspecific comment:
1] “Error in sampler$call_sampler(args_list[[i]]) : "
[2] " c++ exception (unknown reason)”
error occurred during calling the sampler; sampling not done

I used to get things like param is inf or matrix is not semi-definite, but now all I get is unknown reason.

Just in case, I deleted then reinstalled Rstan according to the Gibhub site: . It all seemed to work fine, and it runs etc. but the same lack of error messages is there.

There is a lot at that link. I think you mean change the Makevars file to what it shows for @amos. I’m not sure how to do that. I found a Makevars file deep in R in a folder called sys. It doesn’t look anything like what is suggested. Here it is, from TextEdit. I am afraid to change it, and not sure it will let me.

STANHEADERS_SRC = (shell "(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e “message()” -e “cat(system.file(‘include’, ‘src’, package = ‘StanHeaders’, mustWork = TRUE))” -e “message()” | grep “StanHeaders”)



all: (SHLIB) @if test -e "/usr/bin/install_name_tool" && test -e "/usr/local/clang4/lib/libc++.1.dylib" && test -e "/usr/lib/libc++.1.dylib"; then /usr/bin/install_name_tool -change /usr/local/clang4/lib/libc++.1.dylib /usr/lib/libc++.1.dylib (SHLIB); fi

rm -rf *.so *.o

.phony: all clean

Hi, on Mac, if you have installed @coatless’s package:

then it should work. If it doesn’t then try to update ~/.Makevars in your home directory and recompile packages as needed.

Did all that and still problems. But not exactly like some of the others. I get a lot of those
" c++ exception (unknown reason)”
errors - but if I ask for a lot of chains - like 15 - usually about 80% get that error and 20% run - so I can run the stan code. The same code on a PC seems fine though.
The other thing is that the box that says Check (or Check on Save) tells me so when the code is fine, but just gives a > symbol when it is wrong - no errors show up.

Also updated to R 3.6.2 but no difference.

Hmm, @bgoodri might have better suggestions…

You might get a more instructive error message if you only run 1 chain. It’s not going to solve the problem unfortunately but it might help figuring out what is going wrong.

1 Like

I’m not surprised some chains bomb as there are some non-linear functions that can blow up if the parameters get into strange combinations. That only happens as it looks for starting parameters - once it gets going it is fine. What is inconvenient is that it is not giving me specific error messages. Somehow I believe that is linked to the fact that I don’t get error messages when I am editing a Stan file and click Check or save it with Check on Save activated. It tells me when a file is syntactically correct but just saves it with no comment if there are errors.

Did you find a way to resolve this? I would guess this is an RStudio issue - do other error messages (from other packages) get displayed correctly? Are there any sink calls active?

Hasn’t been resolved. I don’t know what sink calls are. As far as I know I haven’t made any.

Rmarkdown in Rstudio gives error messages.

I’m surprised that this problem appears to be unique to me. I can’t imagine what would be unique about my setup.

But do you see errors from the console in RStudio? Rmarkdown is exactly what may have been consuming the error messages, so I would check code run from console separately.

I checked that but nothing. One main problem is when I click Check on the right side of the window when editing a Stan file in RStudio. If the file is ok, I get the message that it is syntactically correct. If there are problems with it, I just get a new prompt with no messages.

I had this same problem recently. ‘Check syntax’ would return that it was correct when correct and would return nothing when incorrect. It was fixed when re-installing rstan from source (after first removing rstan):

install.packages("rstan", type = "source")

(as suggested by @bgoodri ).

Thank you - I’ll have to try that. I installed several times, including with different installers and changing the Makevars file, but never from source. I would try it now but it’s running a 2-day job. I’ll post the results.

Job ran a lot longer - but finally did this. It worked! Thank you. This looks like the solution.

1 Like