Sometimes the “cure” is worse than the disease. Adverse drug reactions are reported for about 10% of hospitalized patients and about 7% of patients outside the hospital. There are two types. Type A reactions are caused by the ordinary chemical properties of the drug, and make up about 80% of all reported adverse effects. Type B reactions occur only in people who have a predisposition for them, including allergic reactions involving the adaptive immune system.
The immune system generally responds to large molecules, such as proteins. Most drugs are too small to provoke an immune response by themselves, but they can act as “haptens”, which are small molecules that bind to a protein to form an antigenic complex. There is nothing special about drugs in this sense; other components of a pill, such as binders and dyes, can also act as haptens.
The binders and dyes that go into tablets are generally assumed to be safe, inert, ordinary additives that should cause no problem at all. That's also what we generally assume about peanuts, latex gloves, and any number of other products that provoke allergies in susceptible people. Generic drugs have the same “active” ingredients as their brand name counterparts, but the presumed “inert” additives are clearly different. Each drug formulation pill sold (legally) in the United States has a unique appearance in terms of size, shape, and color. For any given person, the brand name pill additives could cause problems but not the generic additives, or vice versa.
It can be difficult to figure out what's causing drug reactions. I used to think most drugs got used up within 4 to 6 hours, but this is not true at all. It takes much longer for almost any chemical to clear out of the body.
About 15 years ago, I had a bad reaction to sulfa drugs. I felt as if something were constricting my chest so I had trouble breathing. Worse, breathing ceased to be automatic. My chest hurt, each breath was laborious. I stopped taking the drugs and recovered. But over the years, I've had recurrent episodes of the same problem.