There are two conditions that can cause a pinhole leak in copper pipe: mixed metals in the plumbing and acidic water. These conditions cause internal corrosion of copper pipes.
When galvanized and copper plumbing are connected in the plumbing of a house or building, electrolysis can happen. To prevent this reaction, connect the pipes with a dielectric fitting. This reaction also occurs when a ground wire touches a galvanized connection on a hot water heater. When electrolysis is ongoing, the copper pipe is pitted by corrosion, leading to a pinhole leak in the copper pipe.
Acidic water corrodes the copper, eventually causing a pinhole leak in the copper pipe. There are three kinds of pitting corrosion not related to mixed metals.
Type one pitting is related to hard water that has a pH level of 7 to 7.8. This is usually associated with cold water. The pitting is deep and spare. It causes pipe failure.
Type two pitting is related to soft water that has a pH below 7.2. It normally doesn't happen when the temperature is below 140 degrees Fahrenheit. This pitting is also narrow and causes pipe failure.
Type three pitting is related to cold water that has a pH level of over 8.0. This pitting is wide and shallow and causes pipe blockage or blue water.