write_metadata_file() was modified in PRs #379 and #383 to always write root.json and <version>.root.json if consistent snapshots = True. Given these changes, we should refactor the following lines: https://github.com/theupdateframework/tuf/blob/0ce016b7b19a0fc15443eed657a90246ec5df0aa/tuf/repository_lib.py#L213-L224
Log files and a closer inspection of this code show that multiple attempts are made to write root.json.
Thanks given to @FelixWang1994 for bringing this issue to our attention.