Sales Invoice Can't be Cancelled Due to Server Error

Hello I can’t cancel my sales invoice. When I click on cancel it appears the attached warning. Why does it happen and what’s the solution further please

?