This error message may also happen when the data contains NA
s.
In this case, the behaviour depends on the defaults (see documentation), and maybe all cases with NA
's in the columns mentioned in the variables are silently dropped. So it may be that a factor does indeed have several outcomes, but the factor only has one outcome when restricting to the cases without NA
's.
In this case, to fix the error, either change the model (remove the problematic factor from the formula), or change the data (i.e. complete the cases).