If the first contract has the price of the soul, the second contract cannot be entered into because the character no longer owns the soul and thus cannot sign it away.
Descent into Avernus (a published adventure) has the necessary rules for infernal contracts.
The contracts are described as:
A hallmark of devils is their delight in striking deals with mortals. These deals are more than mere agreements; they are cosmically binding exchanges in which a devil grants a mortal character some measure of power for a price. Once an agreement is reached, the deal is sealed with a binding contract, which both parties must sign.
[...]
Infernal deals are enforced by the weight of the multiverse itself, by the very essence of the forces of Law and Evil.
That last paragraph in particular does mean that effects that would attempt to "capture" the soul at the moment of death (like soul cage) are unable to divert the soul, as it is bound to hell, and this is enforced by the multiverse itself.
The basic form of a deal, and how it's contracted is described under "Making Deals":
A deal consists of a proposal that covers the terms each party expects, and a contract that seals the deal and makes it binding.
The restriction on a soul being claimed twice is described under "What Devils Want > Souls":
When characters give up their souls to devils, they are promising to serve in the Nine Hells as devils themselves after death. Once promised to a devil, a character’s soul can’t be claimed by another creature.
A characters soul being forfeit is a common penalty clause of an infernal contract, and when the character dies they are instantly reborn in the Nine Hells as a lemure (no chance of revivify etc). This is described under "Infernal Contracts > Breach of Contract":
A character bound by an infernal contract who fails to pay the price specified in the contract immediately suffers a penalty for breaching the contract, as specified in the contract itself. Common penalties include the following:
- The character’s soul is forfeit when the character dies (that is, the character is reborn in the Nine Hells as a lemure).
[...]
It is however, possible to have a contract voided with the agreement of both parties:
Voiding an infernal contract releases all parties from its terms without penalty, as if the deal never happened. Any gifts or prices revert immediately, though some contracts might leave a scar or other lasting effect.
The devil and the character who signed the contract must both agree to void the terms of the contract. As an action, the devil magically produces the contract. When both parties state their agreement to terminate it, the contract crumbles to dust and is destroyed.
[...]
A devilish contract can also be destroyed, and voided as a result:
The Contract Forms table has examples of different forms of infernal contracts. The sections that follow the table describe the various contracts and the means by which they can be destroyed and voided.
The text goes on to describe different contract types and how they can be destroyed.
If neither contract has the soul as the price, but merely as a penalty clause, then it doesn't matter which contract they violate, the Nine Hells still gets its due.
The soul is pledged to the Nine Hells upon violation, not the individual devils. As a result, it doesn't functionally matter which contract they violate, they still forfeit their soul, when they die their soul is still transferred to the Nine Hells, and they are still reborn as a lemure.
This is described under "Infernal Contracts > Breach of Contract":
A character bound by an infernal contract who fails to pay the price specified in the contract immediately suffers a penalty for breaching the contract, as specified in the contract itself. Common penalties include the following:
- The character’s soul is forfeit when the character dies (that is, the character is reborn in the Nine Hells as a lemure).
[...]