Which library are you using to calculate the precision, recall, and f1 scores?
I assume that one of these methods raises the error, so you would have to check the docs what inputs in what shapes are expected.