It does happen sometimes, though no fault of your own. If a customer does not pay an invoice, you as the business owner, are ultimately responsible. Your factoring company should work with you to make it as painless as possible. Most factoring companies will offset the unpaid invoice by holding onto weekly rebates until it is paid back. Another option is to offset with the next advance or take a little of the next few advances until it is paid.
Having a factoring company that helps with collections is key in these situations. The factoring company will have reached out to your customer around the expected payment date. For example, if your invoices are due Net 30, the factoring company may start following up regarding payment around the 40th day the invoice is outstanding. Most factoring companies will try to collect on an invoice for 90-120 days depending on the resource details of your factoring agreement. By reaching out early, you have time to work out a plan for repayment before the invoice reaches 90-120 days old.
The most important thing is to not panic. Losses are unfortunately a part of business. Partnering with your factoring company will minimize those losses and keep your cashflow on the right track.