For the past two days we are facing this issue in our SIT and dev environments when posting sales order invoices.
This issue is occurring for both fresh and old records.
Below is the error we are getting and posting is not happening:

There are no customizations involved while posting. The issues is not occurring in UAT.(UAT, SIT & DEV versions are same)
We tried debugging for the issue and below is the call stack.

Kindly help with your suggestions and ideas on this issues.