Could you describe your use case a bit more and which method raises the issue?
Based on your current description I guess you are using a 3rd party package (e.g. sklearn.metrics.confusion_matrix) which tries to normalize the confusion matrix and might be running into a zero division?