Debugging models

When your model exits with a message like so:

┌ Error: The model exited at model time 2024-01-27T14:46:17.791 with return code Unstable. See https://docs.sciml.ai/DiffEqDocs/stable/basics/solution/#retcodes

it’s best to rerun the model with saveat = 0 in the solver settings. The model might then instead exit with

┌ Error: Too large water balance error
│   id = Basin #2
│   balance_error = 0.0017985748886167501
│   relative_error = 1.3503344464431657

which helps you pin down the problematic node(s). The normal output for every calculation timestep is written until the moment of error, so one can use this information to understand the problem.