I can help you in resolving the error you're having with applying a credit memo to an invoice.
It's possible that piled-up cache in your regular browser caused this unusual behavior when trying to apply this credit memo. You can clear your current browser’s cache to resolve this.
You can clear your browser’s cache and cookies to fix them. But first, try using a private browser or an incognito window when trying to apply this credit memo. If you no longer have the error, then you can clear the cache in the one that you're currently using if it works.
For Chrome, press Ctrl + Shift + N.
For Microsoft Edge or Firefox, press Ctrl + Shift + P.
You'll want to check if the invoice isn't linked to a project. This might be the reason why you're unable to apply the credit note. Also, check the Credit note if it's having the same customer as the same with the invoice.