checkout: avoid BUG() when hitting a broken repository