I'm not sure if this is me or not, but the develop cmdstanr isn't forwarding me my error messages.
If I compile a model with a syntax error:
parameters {
row_vector[3] a;
vector[3] b;
}
model {
matrix[1, 1] c = a * b;
}
With this R code:
library(cmdstanr)
model = cmdstan_model("/home/bbales2/tmp/test.stan")
I'm getting weird errors (instead of the syntax errors I expect):
> model = cmdstan_model("/home/bbales2/tmp/test.stan")
Compiling Stan program...
Error in processx::run(command = make_cmd(), args = c(tmp_exe, cpp_options_to_compile_flags(cpp_options), :
System command error
I get this (Ubuntu):
Compiling Stan program...
Error in processx::run(command = make_cmd(), args = c(tmp_exe, cpp_options_to_compile_flags(cpp_options), :
System command 'make' failed, exit status: 2, stderr (last 10 lines):
E> 5:
E> 6: model {
E> 7: matrix[1, 1] c = a * b;
E> ^
E> 8: }
E> -------------------------------------------------
E>
E> Ill-typed arguments supplied to assignment operator =: lhs has type matrix and rhs has type real
That's what I'd expect. Ubuntu here too. Any changes here lately? I'm pretty sure I got these errors before.
Huh, no. Except for the _threads suffixes, not really. rebuild_cmdstan() might get you out of this bug, but might be worth exploring what is happening.
I however don't like this format of messages. Mentioning make, processx and whatnot is probably confusing for the users. Gonna fix this real quick.
Error in processx::run(command = make_cmd(), args = c(tmp_exe, cpp_options_to_compile_flags(cpp_options), :
I agree I don't think the processx command helps. The make thing is at least giving a clue that it's compile.
This is much better imo:
Compiling Stan program...
/
Semantic error in '/tmp/RtmpSiPdjL/model-692018715e71.stan', line 7, column 2 to column 25:
-------------------------------------------------
5:
6: model {
7: matrix[1, 1] c = a * b;
^
8: }
-------------------------------------------------
Ill-typed arguments supplied to assignment operator =: lhs has type matrix and rhs has type real
make: *** No rule to make target '/tmp/RtmpSiPdjL/model-692018715e71.hpp', needed by '/tmp/RtmpSiPdjL/model-692018715e71'. Stop.
Error in self$compile(...) :
An error occured during compilation! See the message above for more information.
Without the E> and the rest.
I dont like the "Semantic error in '/tmp/RtmpSiPdjL/model-692018715e71.stan'" and have an idea on how to fix this. I think rstan also compiles in tmp folders and I find it slightly annoying. Opening a PR in a sec to fix the message.
Yeah you're right. No need for make
Well sometimes I go grab temporary outputs -- when I'm trying to figure out c++ toolchain problems or whatever.
For what it's worth, on my mac I get this:
Compiling Stan program...
Error in processx::run(command = make_cmd(), args = c(tmp_exe, cpp_options_to_compile_flags(cpp_options), :
System command 'make' failed, exit status: 2, stderr (last 10 lines):
E> 6:
E> 7: model {
E> 8: matrix[1, 1] c = a * b;
E> ^
E> 9: }
E> -------------------------------------------------
E>
E> Ill-typed arguments supplied to assignment operator =: lhs has type matrix and rhs has type real
E>
E> make: *** No rule to make target `/var/folders/h6/14xy_35x4wd2tz542dn0qhtc0000gn/T/RtmpzY8D5F/model-11a99479cfaaf.d', needed by `/var/folders/h6/14xy_35x4wd2tz542dn0qhtc0000gn/T/RtmpzY8D5F/model-11a99479cfaaf'. Stop.
which seems to be correct. But I agree the message would look better without the processx info at the top, without the E>, and without the make stuff.
Well sometimes I go grab temporary outputs
Yes, I get that. But there should be a way to override this:
Semantic error in /tmp/RtmpSiPdjL/model-692018715e71.stan, line 7, column 2 to column 25:
-------------------------------------------------
5:
6: model {
7: matrix[1, 1] c = a * b;
^
8: }
-------------------------------------------------
Ill-typed arguments supplied to assignment operator =: lhs has type matrix and rhs has type real
The first line should be "Semantic error in ~/stan-examples/eight-schools.stan" or whatever. The actual model name & path. But if I am the only one annoyed by this, its not worth it. Would be a stanc3 fix.
But if I am the only one annoyed by this, its not worth it. Would be a stanc3 fix.
I find it annoying too, so would be happy to see it fixed. But not a super high priority if it's a pain to change it.
The first line should be "Semantic error in ~/stan-examples/eight-schools.stan" or whatever
Right again, that is better.
My rstudio must have been sick. I just ran this stuff again today and I got the error :/.
Still got us to make the error nicer so its a win.
Most helpful comment
Still got us to make the error nicer so its a win.