Imagine that you're 119 years old.
You ask your rabbi whether or not something is allowed. He answers. But, unbenownst to you, his answer is 100% mistaken. The Talmud and all others agree unanimously that the thing is forbidden. But your rabbi misremembers what it says in the Talmud, and he says it is allowed.
For the next two years, you do the thing, thinking it's allowed.
On your 121st birthday, while doing the thing, you suddenly die instantly. Not due to doing the thing: just due to old age. You die without having said the deathbed confessional prayer (see the "Death and Bereavement" section of the ArtScroll Siddur).
Will G-d punish you for having done the thing?
(This question was inspired by a discussion between Akiva Miller and R' Yosef Gavriel Bechhofer.)