Are you familiar with the Peter Principle?
The Peter Principle is the principle that "In a Hierarchy Every Employee Tends to Rise to His Level of Incompetence".
The principle is based on the fact that promotions are given to competent employees. When an employee stops being promoted, it means that he's no longer competent enough. Smart and small organizations are somewhat protected against such situations, but large companies are at risk. When giving out promotions, who's going to get it? A great employee that is doing his job perfectly and might not have the necessary skills for the new one or an average employee that might also not have the necessary skills for the job but is maybe better than the other one. Of course, since promotions are accompanied by more money (and power) the good employees won't accept that a bad employee gets the promotion. So good employees get promoted (sometimes not, but on average) until they are no longer good at their position.
The solution? First, the employee should consider not taking the promotion if he feels inadequate for the position. If he wants the position but doesn't think he has what it takes, ask for training first, then get the job. The management should also be aware of the potential problems and maybe offer a raise and/or slowly change the responsibilities of the employee instead of changing them completely. A programmer can become a team leader over time, it doesn't have to be a one-time event.