Add better error message on invalid format for files