The following I found out the hard way: I have a good, consisting out of two substances (summing up to 100%). However, in my case it is common to define the mass flow of the good by the mass flow of one substance and its concentration in the good. (To be specific, it is the dry matter mass flow of sewage sludge. This is commonly done because the water content changes a lot throughout the processes, while the dry matter mass flow stays constant. )
So I set my model up by defining the substance 1 (dry matter) mass flow and the concentration in the good (sewage sludge). The good mass flow was calculated correctly. Second I defined the concentration of substance 2 (water). Surprisingly the mass flow of substance 2 could not be calculated although the good mass flow and the substance 2 concentration was known.
The workaround is to set the good mass flow instead of the substance 1 mass flow. This is a slight drawback because all input data I have is always given in substance mass flows and has to be converted to the good mass flows to get the model working.
I think this has something to do with the solver. May be in a new revision such cases can be covered as well.
I created a small example. The upper configuration works. The lower produces an error message. However, in a more complicated example it failed completely. (I don't have it anymore because I use a workaround now.)
On my side, both versions in your example file work perfectly well. What version of STAN are you using?
I have to confess that the error messages with respect to critical problems are not very helpful, sorry.