Smokers who sought medical help while trying to kick the habit were accidentally prescribed Viagra instead of an anti-smoking drug.
The blunder was caused by a technical problem with a computer system that automatically selects a list of drugs when GPs fill out a prescription. When doctors tried to choose the anti-smoking pill Zyban their computers instead selected sildenafil, the generic name for Viagra, the anti-impotence pill.
All 900 GPs in the Greater Glasgow area where the blunder has been uncovered have been contacted by email about the mix-up.
It is not known how many smokers have been surprised by the effect of their "anti-smoking pills", but only two GP practices have complained about the problem.
Greater Glasgow and Clyde Health Board said the error should have been picked up either by GPs while signing prescriptions or by pharmacy staff.
One Glasgow doctor said yesterday: "Thankfully the side effects of taking Viagra in error are not too serious."