I am a bit surprised that your script does not check if the model is gone before doing anything else... Having a check will safeguard you from many possible surprises :D
However, about your specific concern....
Destroying a model is a complex multi-step process that has some asynchronous steps. It's possible that occasionally the operation to remove a cloud gets attempted before some model steps are yet to run.
We could potentially add a --force to remove-cloud operation but I am not convinced that we REALLY want to force remove a cloud that is still being used by some models... We have no means of "changing" a cloud for a model, so these models might become unusable and indesructible.
I am a bit surprised that your script does not check if the model is gone before doing anything else... Having a check will safeguard you from many possible surprises :D
However, about your specific concern....
Destroying a model is a complex multi-step process that has some asynchronous steps. It's possible that occasionally the operation to remove a cloud gets attempted before some model steps are yet to run.
We could potentially add a --force to remove-cloud operation but I am not convinced that we REALLY want to force remove a cloud that is still being used by some models... We have no means of "changing" a cloud for a model, so these models might become unusable and indesructible.