IANAL, but the law takes this into account by requiring mens rea to be convicted of many crimes [0]... for example, 1st degree murder. If it's an accident, it's not 1st degree murder because intent must be proven. At best, an accident might result in some lesser charge that carries less time in prison. So I doubt your scenario (a mistake results in life in prison) would ever occur.
0. https://en.wikipedia.org/wiki/Mens_rea