A customer signs up for a weekend workshop. Two invoices arrive for the same seat. They show the same amount and different invoice numbers. The customer has to ask which one to pay.
In this fictional example, the organizer is replacing the job that issues invoices. The old worker finds a confirmed registration with no invoice on record and sends a request. The billing provider issues the invoice, but the reply never reaches the worker. When the new worker checks that same registration, there is still no invoice on record. It sends a request of its own.
Both workers had a reasonable answer to the question their code asked: Is there an invoice on this registration? Neither had a rule that kept it from acting while the other worker might already have sent a request.
The new worker is ready. One invoice is still unresolved.
Go back to the moment the old worker timed out. The organizer can see the registration and the timeout, but can't tell whether the provider issued the invoice. Retrying could produce the duplicate from the opening. Waiting could leave the customer without a bill. Giving the new worker the job doesn't resolve either possibility. It sees the same blank field.
I'd keep that registration out of automatic billing until someone can account for the request. If the provider has an invoice that matches the registration and expected amount, link it. The customer can pay the invoice they already received.
If the team can't find the invoice, a safe retry depends on what it sent the first time. In this example, one registration gets one initial invoice. Both workers can use the same idempotency key, an identifier that tells the provider a request is a repeat of the same operation. Retry only if the original request used that key and the provider still guarantees that repeating the identical request won't create another invoice. Otherwise, leave the registration on the exception list for someone to resolve.
Give the next registration one billing owner
While the organizer checks the old request, more people can sign up. If invoices can go out a little later, I'd pause new billing claims and keep accepting registrations. Stop the old worker from taking more work, account for the requests it already started, then let the new worker take over. A short pause avoids adding routing rules the team will have to remove later.
If the organizer needs invoices to keep going out, move one workshop at a time. The old worker keeps billing the other workshops while the new worker previews what it would send for the one about to move. The preview makes no billing requests. To switch, block new claims by the old worker for that workshop, account for its outstanding requests, and transfer ownership.
In a shared database, the team can lock the same ownership record when a worker claims a registration or when the team transfers a workshop. That keeps ownership from changing between the check and the claim. Queued retries must pass the same check. The ownership record decides who may send the request; the key protects the invoice if a request repeats.
If the team rolls back after the new worker starts billing, the old worker may see registrations it never invoiced itself. Before handing ownership back, stop the new worker from taking more work and account for what it already sent. If the old worker can't recognize those invoices or respect the holds on unresolved registrations, pause billing for that workshop.
Check who was billed before moving the next workshop
Suppose two registrations were ready for billing at the handoff, and the provider shows two invoices after the first run. The totals agree. But both invoices may belong to the customer from the opening, while the second customer is still waiting.
Save the list of eligible registrations before switching a workshop. After the first run, match each one to the provider's records and check the amount. Include invoices the old worker issued as well as those from the new one. Track later signups separately so they make it into the next run. The organizer should be able to see one correct invoice per registration or an exception with someone responsible for it. If that list still leaves them guessing, leave the next workshop with the old worker.
Related principle: Optimize for Change.

