I think a big pile of pain here can be removed once we run the the migrate local to the cloud job.
I am pretty sure @tgxworld rewrote a lot of the process to avoid this particular failure case. Can we close this @tgxworld ?