When this error occurs
Get the time the error occurred.
Go to OD COnfig > scheduled tasks logs
check the error in the log.
You will get the shipment ID around that time for which it failed.
Open the shipment > open the order > look for invoices.
There will be a pending payment invoice
Open the invoice > re process teh payment from actions > status should change to paid automatially and shipment and ordr should refresh
Once it is updated, copy the invoice id and paste it in the Shipment custom fields for invoice ID and save
This will correct the error.