Los Angeles Superior Court Judge Elihu Berle's verdict came after an eight-year legal battle between a small nonprofit group and the coffee industry, the Associated Press reported.
The Council for Education and Research on Toxics sued to force the industry to either remove a known carcinogen called acrylamide from coffee or to warn consumers about the chemical that's produced when coffee beans are roasted.
The industry argued that the level of acrylamide in coffee isn't harmful and that any risks are outweighed by benefits, the AP reported.
In his ruling, Berle said the coffee industry didn't make a strong enough case.
"While plaintiff offered evidence that consumption of coffee increases the risk of harm to the fetus, to infants, to children and to adults, defendants' medical and epidemiology experts testified that they had no opinion on causation," Berle wrote in his proposed ruling.
"Defendants failed to satisfy their burden of proving ... that consumption of coffee confers a benefit to human health," he stated.
The defendants, which include Starbucks and 90 other companies, have a few weeks to challenge the ruling before it is final. Many coffee shops in California have already posted warnings saying that acrylamide is cancer-causing chemical found in coffee, the AP reported.
The coffee companies have said it's not feasible to remove acrylamide from coffee without affecting taste, but the lawyer who led the lawsuit said that's not true.
"I firmly believe if the potato chip industry can do it, so can the coffee industry," said Raphael Metzger said, the AP reported. "A warning won't be that effective because it's an addictive product."
Potato chip makers were forced to remove acrylamide after the Council for Education and Research on Toxics sued them years ago.
While there is no firm evidence on whether coffee is good or bad for you, the World Health Organization removed coffee from its "possible carcinogen" list in 2016, the AP reported.
Research shows that coffee is unlikely to cause breast, prostate or pancreatic cancer, and it may lower the risk of liver and uterine cancers, according to the WHO. There is not enough evidence to ascertain the relationship between coffee and dozens of other types of cancer.