This should go above the `if` clause immediately above it, so we get the nicer error message for all file types.