Fix panic for `fixBrokenRepoUnits16961` (#30068)

(cherry picked from commit 08aec2c20adae8e6f04cac08566a8decd818e5cd)
authored by