About a decade ago, researchers began to observe a recurring challenge in their research: Some of the compounds they were developing to harness energy from bacteria were instead killing the microbes.