Puppet deploy fails with “Object not found – no match for id”

Last week I force-pushed to the r10k-control repo and ran into something like this: https://tickets.puppetlabs.com/browse/RK-297 I fixed it by deleting all environment branches from Bitbucket then POSTing {“deploy-all”:true,”wait”:true} to https://puppet.local:8170/code-manager/v1/deploys and then pushing all environment branches to Bitbucket again and doing the same POST request again.