FYI: the gun mechanism was the Uranium Bomb. Trinity tested the Plutonium (implosion) Bomb.
IMO if it was a hardware failure (e.g. IIRC there were thought to be potential 'issues' with the fuses timing the charges that imploded the bomb)
then they would just work out what had failed and try again.
If it just didn't work then it would have been back to the drawing board because there had been a theoretical mistake somewhere. Eventually they would work it out, redesign and try again.
As stated above, the Uranium bomb is the alternative. The Manhattan Project scientists were so sure that was going to work that they didn't even have a test explosion. However, there was a test: the gun mechanism was used to fire a Uranium 'slug' through a modified Uranium 'target'. The target was modified so that the 'slug would fly straight through at high speed, assembling a critical mass and then de-assembling it again before the chain reaction could complete. It was a complete success (e.g. monitoring showed exactly what theory predicted) The scientists were totally confident that if the 'target' hadn't been modified then the chain reaction would have occurred and hence that the bomb would explode.