I wonder what if the priest is in a state of sin. Does the sacrament become invalid? When your access to God is dependent upon a mortal man what if that man is like many priest in rebellion with the church. Is your confirmation, communion, confession, marriage, etc. all invalid?
That really doesn’t answer the question.
Everyone last one of us is in a state of sin of some kind or other simply by virtue of the fact that we are still living on this planet.
However, I think more in mind is the concept of known, egregious, unrepentant sin of the priest. Things like sexual sin, or other mortal sins that the priest is continuing to participate in. I don’t need to give examples. Anyone can think of them themselves.