Quantum deviations or coherent noise are a typical type of noise when implementing gate operations in quantum computers, and their impact on the performance of quantum error correction (QEC) is still elusive. Here, we consider the topological surface code, with both stochastic noise and coherent noise on the multi-qubit entanglement gates during stabilizer measurements in both initial state preparation and error detection. We map a multi-round error detection protocol to a three-dimensional statistical mechanical model consisting of Z_2 gauge interactions and related the error threshold to its phase transition point. Specifically, two error thresholds are identified distinguishing different error correction performances. Below a finite error threshold, in stark contrast to the case with only stochastic errors, unidentifiable measurement errors can cause the failure of QEC in the large code distance limit. This problem can only be fixed at the perfect initial state preparation point. For a finite or small code with distance d, we find that if the preparation error rate is below a crossover scale ~1/log(d), the logical errors can still be suppressed. We conclude that this type of unavoidable coherent noise has a significant impact on QEC performance, and becomes increasingly detrimental as the code distance increases.