If it was not possible to keep the vows or if the vows were not made in good faith and with appreciation of the meaning of Catholic marriage by both parties, that would not be a real (i.e. valid) attempt at marriage. If either or both parties made their vows in good faith and with understanding but lack the capacity, that would not be a valid marriage. IOW, vows can even be made in good faith by both parties, a true marriage that could last may still not be there. In those cases, yes, the Church will make a finding that the marriage was null and allows another attempt at marriage for persons with the capacity. (They’re not going to make a finding of permanent incapacity and then let the incapable person have another run at it…)
If, OTOH, a true marriage was made that both parties are capable of fulfilling, but one or both sins grievously, violates the marriage bed and alienates the affection in the marriage or in some other way makes living together in peace impossible, that does not make the marriage invalid. It may relieve the duty to live the conjugal life together, which in turn might make a civil divorce permissible in order to divide the assets justly, but the couple’s vows, once made validly, bind for life, for better or for worse.
God’s mercy does not mean we can presume to abandon our vows. If we are faithful, even if offended against, we will not go without our reward for our fidelity.