When does assert fail? Running out of space?

I’m not sure. I’ve used the code as above and it seems to work, but I’ve had to figure it out from trial and error.

catch (:Goal, +Catcher, :Recover) sadly seems to be another fundamental part of Prolog lacking simple, illustrative examples.

From Googling, I see you’ve asked for clarification on catch/throw here https://swi-prolog.discourse.group/t/catch-throw-recover-until-its-suceeds/288,and I’d also appreciate a clear answer on how to use catch.