Water is detrimental to electronic devices because it easily causes short circuits. The use of sealing to prevent water permeation is considered as the current conventional solution; however, the trend for developing flexible and stretchable electronic circuits has placed severe demands on waterproof technologies. This report describes a coating that protects circuits and prevents between-wire short circuits, even if the waterproof seals are damaged and the circuit becomes wet. We show that when Cu electrodes are coated with cellulose nanofibers (carboxylate content of 1.8 mmol/g), short circuits between the electrodes do not occur, even if the circuit is submerged in water for 24 h. The cellulose nanofibers accumulate at the anode because of electrophoresis, thereby forming a cohesive cellulose nanofiber layer that prevents short circuits between electrodes. Even if the cellulose nanofiber coating cracks because of external factors, the electrophoretic effect repairs the coating. This failure-containment mechanism is expected to be used in combination with existing waterproofing technology to dramatically improve the reliability of next-generation electronic devices under extreme operating conditions.