A lot of those are not idempotency. Whenever you check if the file exists before creating it assumes the content of the file that does exist is the same as what you're trying to put in, which is not always true. Same for the mkfs example. Presumably the volume might already have a fs on it that you want to overwrite which is not ext4