There are some rules and limitations on the Xero API: Caps on time limits, data used, and the number of transactions within a time period. The 'Object reference not set to an instance of an object'  implies that we have exceeded our API rate limit from Xero for the day and you will need to wait for at least 1 hr to retry it again.

Xero API:
https://developer.xero.com/documentation/guides/oauth2/limits/ 



As a workaround, please split your invoices into different batches, rather than having too many invoices sitting in just one batch to prevent this from happening again. Keeping a maximum of 10-15 invoices in a batch should help prevent this from happening again.
You can also set a limit on how many invoices can be in a batch before the system automatically create a new batch and put the next invoices into the next new batch: