It's hard to pinpoint without a reproducible example, called a reprex, but a function expects a factor argument with two or more level and isn't seeing it.
Take a look at your environment
ls()
for objects that you know or suspect the function may be operating on, then
str(obj)
inspect the structure of the object. If there are factors, it will tell you how many levels.