SAN FRANCISCO — San Francisco police apprehended Antoinette Cowden in the Tenderloin last year with 5.55 grams of crack and $147. Since it only takes five grams to trigger a five-year mandatory minimum sentence in federal prison, the guilty plea to which she agreed shortly after getting caught would have carried at least that much time.

Then came disclosures of disastrous problems in San Francisco’s drug lab, where Cowden’s crack had been weighed. As a result, Assistant U.S. Attorney Matthew McCarthy recently announced in court that the weight would be recalculated to between four and five grams — thus eliminating the mandatory minimum, according to Morgan, Lewis & Bockius partner John Hemann, Cowden’s court-appointed lawyer.