In his work on modularity of elliptic curves and Fermat's Last Theorem, A. Wiles introduced two measures of congruences between Galois representations and between modular forms. One measure is related to the order of a Selmer group associated to a newform f ∈ S2(Γ0(N )) (and closely linked to deformations of the Galois representation ρ f associated to f ), whilst the other measure is related to the congruence module associated to f (and is closely linked to Hecke rings and congruences between f and other newforms in S2(Γ0(N ))). The equality of these two measures led to isomorphisms R = T between deformation rings and Hecke rings (via a numerical criterion for isomorphisms that Wiles proved) and showed these rings to be complete intersections.We continue our study begun in [BKM21] of the Wiles defect of deformation rings and Hecke rings (at a newform f ) acting on the cohomology of Shimura curves over Q: it is defined to be the difference between these two measures of congruences. The Wiles defect thus arises from the failure of the Wiles numerical criterion at an augmentation λ f : T → O. In situations we study here the Taylor-Wiles-Kisin patching method gives an isomorphism R = T without the rings being complete intersections. Using novel arguments in commutative algebra and patching, we generalize significantly and give different proofs of the results in [BKM21] that compute the Wiles defect at λ f : R = T → O, and explain in an a priori manner why the answer in [BKM21] is a sum of local defects. As a curious application of our work we give a new and more robust approach to the result of Ribet-Takahashi that computes change of degrees of optimal parametrizations of elliptic curves over Q by Shimura curves as we vary the Shimura curve.