A person is sometimes punished even in the performance of a mitzvah. This is because he previously passed up an opportunity to fulfill just such a positive command.
A person sometimes unknowingly passes judgment on himself (by being asked to select a fitting punishment for someone else).
There are times when a person is killed because he failed to speak out on behalf of someone who is unjustly despised.
A person will sometimes be punished for having engaged in some illegal business practice, or because (he has been included in) a harsh decree passed against his neighbours or nation.
The Holy One hastens to exact punishments from an ungrateful person, punishing him at the hands of another ingrate.
A person bitten by a dog has either accepted malicious gossip or spoken it.
Source: Sefer HaMiddot (The Book of Attributes) - Rabbi Nachman of Breslov
translated by Moshe Mykoff