If the matrix is very ill-conditioned, then A^T A becomes numerically rank deficient. However, if you use a reasonably large positive regularization constant (lambda), "A^T A + lambda I" should be still positive definite. What was the regularization constant (lambda) you set? Could you test whether the error still happens when you use a large lambda?
Best, Xiangrui