I am writing a book about partnerships between animals and microbes. In the process, I have consumed a frankly obscene amount of coffee, to the extent that the dedication might just read “To coffee, with thanks”. So, it is with mixed emotions that I now write this post, about an animal that is ruining coffee with the help of bacteria.

The coffee berry borer is a small, black beetle, just a few millimetres long. The females bore holes into coffee berries and then lay their eggs in the seeds within—the bits that we know as “coffee beans”. The larvae devour the seeds when they hatch, destroying them. In Brazil alone, its antics lead to some 300 million dollars worth of losses, and it has spread to coffee-making nations all over the world. This tiny pest is the single greatest threat to your cup of blissful java.

View Images Coffee berry borer beetle. Credit: L. Shyamal (CC BY-SA 3.0)

The beetle is the only animal that can feed solely on coffee beans. Others might occasionally nibble the seeds or other parts of the coffee plant, but they don’t dedicate themselves to the task. There’s a reason for that: caffeine. This stimulant draws many of us to coffee, but it effectively deters plant-eating animals. Not only does it taste bitter, but at the doses found in coffee seeds, it can poison and paralyse any wayward insect. Any insect, that is, except for the coffee berry borer. As a larva, it’s practically bathed in caffeine, and yet it survives. Even the most caffeine-rich beans fail to deter it.

Javier Ceja-Navarro from the Lawrence Berkeley National Laboratory has discovered its secret: it has bacteria in its guts that can detoxify caffeine.

When he fed the beetles with coffee beans and analysed their faeces for traces of caffeine, he couldn’t find any. None. Something in their gut had completely destroyed the would-be poison. Bacteria seemed like the obvious candidates, so Ceja-Navarro fed the beetles with antibiotics. This time, when they ate coffee beans, their poo was laden with caffeine. And when they got a chance to breed, they utterly failed. Most of their eggs and larvae died outright, and none of the survivors made it to adulthood. Without their microbes, they couldn’t handle their caffeine.

Ceja-Navarro’s team, led by Eoin Brodie, found that the bacteria in the coffee berry borer’s gut vary from country to country, but some species turn up everywhere. At least a dozen of these can grow on caffeine and nothing else, and one—Pseudomonas fulva—was especially good at it. It’s was the only microbe with a gene called ndmA, which starts the process of metabolising caffeine.

When Ceja-Navarro fed P.fulva to the antibiotic-treated beetles, he restored their ability to metabolise caffeine. Then again, the insects still couldn’t reproduce, which suggests that other bacteria also affect its health, and perhaps its ability to withstand its toxic meals.

Whether this discovery will help coffee farmers is not clear. It would be a truly terrible idea to start spraying coffee plants with antibiotics, but perhaps there might be subtler ways of breaking the alliances between the beetles and their detoxifying microbes.

Detoxification is only one part of the coffee berry borer’s success. There’s also digestion. Coffee berries are 60 percent carbohydrates, and since the beetle larvae eat nothing else, they need some way of breaking down these large, tough molecules.

In 2012, Ricardo Acuña from Cenicafé, a Colombian coffee research centre, discovered its trick by analysing the genes that are switched on in its guts. One of them – HhMAN1 – stood out for two reasons. First, it creates a protein called mannanase that breaks down galactomannan, one of the major carbohydrates in coffee beans. Second, insects aren’t meant to have mannanases.

Acuña found that the beetle’s version of HhMAN1 is most closely related to genes from bacteria. He checked to make sure that he hadn’t sequenced some contaminating microbe, and indeed he hadn’t: HhMAN1 was surrounded by other typical insect genes and was clearly a bona fide part of the beetle genome.

So, at some point in their history, these beetles stole a gene from bacteria, perhaps the same ones that live in its gut. That gene now lives permanently in their genome and allows them to digest the signature carbohydrates found in coffee beans.

Bacteria, then, have helped the beetle in two ways—by donating a digestive gene at some point in the distant past, and by donating their detoxifying powers in the present. Boosted by microbial power, the beetle has become a worldwide pest, and a royal pain-in-the-espresso.