Sorry for my delay, missed this totally…
To avoid failing you would probably need some sort of custom logic to check availability of a given version.
Just thinking if there is an issue with build triggers when this is needed. No need to trigger and publish if nothing has happened i.e. no new version.