The field tests seem simple, but a lot can go wrong. Some tests, including the one the Houston police officers used to analyze the crumb on the floor of Albritton’s car, use a single tube of a chemical called cobalt thiocyanate, which turns blue when it is exposed to cocaine. But cobalt thiocyanate also turns blue when it is exposed to more than 80 other compounds, including methadone, certain acne medications and several common household cleaners. Other tests use three tubes, which the officer can break in a specific order to rule out everything but the drug in question — but if the officer breaks the tubes in the wrong order, that, too, can invalidate the results. The environment can also present problems. Cold weather slows the color development; heat speeds it up, or sometimes prevents a color reaction from taking place at all. Poor lighting on the street — flashing police lights, sun glare, street lamps — often prevents officers from making the fine distinctions that could make the difference between an arrest and a release.
There are no established error rates for the field tests, in part because their accuracy varies so widely depending on who is using them and how. In Las Vegas, authorities re-examined a sampling of cocaine field tests conducted between 2010 and 2013 and found that 33 percent of them were false positives.(Later in the article, a pretty decent description of mass spectrometry.)
I'm surprised that there hasn't been a switch to an antibody-based test, but I am guessing there are both cost and technical issues there.