  We study the fidelity of the surface code in the presence of correlated
errors induced by the coupling of physical qubits to a bosonic environment. By
mapping the time evolution of the system after one quantum error correction
cycle onto a statistical spin model, we show that the existence of an error
threshold is related to the appearance of an order-disorder phase transition in
the statistical model in the thermodynamic limit. This allows us to relate the
error threshold to bath parameters and to the spatial range of the correlated
errors.
