Starbucks and other major retailers could be forced to warn Californians that a cup of coffee is hazardous to their health.

The reason is a long running lawsuit that invokes a voter-passed law, Proposition 65, that identifies harmful chemicals and compels businesses to post warnings when those substances are present.

One chemical on the state’s list is acrylamide, which occurs naturally in some foods and is produced when coffee is roasted. California associates it with both cancer and developmental issues. Fast food titan KFC was ordered by the state a decade ago to warn customers about the chemical appearing in fried and baked potatoes.

A lawsuit filed by the Council for Education and Research on Toxics alleges that prominent coffee sellers like Starbucks, Peet’s and BP — which oversees a massive gas station chain — have failed to notify customers about the risks of acrylamide.

Yum Yum Donut Shops, 7-Eleven and Gloria Jean’s Gourmet Coffees have already agreed to post warnings and pay fines in accepting settlements. The remaining parties have been engaged in a protracted court fight, and a ruling is expected some time in the coming months.

Britain's caffeine boom: Why can't we wake up without smelling the coffee? Show all 3 1 /3 Britain's caffeine boom: Why can't we wake up without smelling the coffee? Britain's caffeine boom: Why can't we wake up without smelling the coffee? Bean there: A branch of the ubiquitous Starbucks EPA Britain's caffeine boom: Why can't we wake up without smelling the coffee? A woman picks beans in central Kenya Reuters Britain's caffeine boom: Why can't we wake up without smelling the coffee? Caffe Nero offers its customers free wi-fi Alamy

Starbucks won an early victory when a judge denied the Council for Education and Research’s push to find the company violated the law. The same judge ruled against Starbucks in a subsequent phase of the proceedings, rejecting its argument that the amount of acrylamide in coffee is slight enough to cancel out cancer risks.

“Coffee does not cause cancer,” Kyra Auffermann of the National Coffee Association, a trade group that has been the public face of major coffee sellers' response to the suit, said in an email.

Latte levy: The plastic problem inside your coffee cup

While it has drawn praise for safeguarding clean water and protecting Californians from toxic substances, Proposition 65 has also been a target for critics who warn unscrupulous lawyers are using it to shake down businesses. The owner of Santa Cruz Coffee Roasting told customers in 2013 he was reluctantly posting warning labels, assailing “ this particular interpretation of a well-intended bill” as “a great waste of our money and resources”.