Add_criterion with moment_match=TRUE failing even when save_pars(all=TRUE) was set during model fit

With the update, the reprex you gave did work for me (I can retest later)

Agreed, that the reprex runs. Trying to figure out why my original code still errors. Will respond with any additional information as necessary. Appreciate you remediating that initial issue!

If you are able to produce a new reprex that fails, that would help

I’m going to mark your earlier post as a ā€˜solution’.

The previous add_criterion() that used to completely crash RStudio no longer causes it to crash and a seemingly separate issue with add_criterion (the primary one the reprex was designed to solve) still shows an error but runs to completion, which I’m assuming is a try() or tryCatch() solution which was implemented. Should those errors remain to be shown even if the loo function runs to completion? Perhaps add a line to turn this non-fatal error into an official ā€˜warning’? (see image for what I’m seeing as an end-user)

Edit: just realized I didn’t start this thread so I can’t mark it as a solution, but I consider this solved

Thanks for confirming this.

If I remember correctly, I considered this but couldn’t stop Stan outputting that error message and Stan core developers told that the specific error message can’t be suppressed easily. We don’t want so suppress all error message. I could add an additional informational message that these error messages are not fatal. There is no reason for warning, as the algorithm is working as expected. I’ll recheck the what I can do for the error messages.