nit: Could put this error message in a variable and use the variable as it is repeated four times.