Restore the list of versions on an error

Fixes #2249