How to fix invoice creation errors