Are there good defenses for being caught with drugs? Absolutely. Just like you can make a mistake, law enforcement officers can as well. One of the most common defenses is based on an unlawful search and seizure. This defense focuses on the fact that your Fourth Amendment rights have been violated. If this can be proven, then your case may be dismissed from court.
The Fourth Amendment guarantees you the right to due process. This includes the right to a lawful search and seizure. Officers looking to arrest need to follow the correct legal channels to find drugs in your possession. For instance, if you're pulled over at a stop light, it would be okay for a cop to see drugs on your dashboard and take them from you, since they were in plain view.
However, without a reason to suspect you have drugs, the officer has no reason to ask you to open your vehicle or allow a search. If you don't give permission because no reason for a search is given, then it can be said that the search is a violation of your rights. Generally speaking, when this kind of issue occurs, your charges will be dismissed.
You can also make an argument that the drugs aren't yours. For instance, if you had no idea a passenger in your vehicle had left drugs in your car, then you can lawfully claim they aren't yours and that you had no idea they were in your possession. These are just a few of the drug charge defenses you can try; your attorney will be familiar with others.
Source: FindLaw, "Drug Possession Defenses," accessed Feb. 19, 2016