I am getting this error randomly while running optimization using NLopt

Since it’s inverse of a 2x2 matrix, I wrote out the formula of inverse matrix and it works without the error.
Thank you very much for the help!