On June 14, 2016, four researchers at the Jet Propulsion Laboratory were preparing to ship a waist-high, ape-like robot named RoboSimian off-site. They had built the bot to rescue people from dangerous situations that human rescuers can’t hack. The scientists swapped one lithium-ion battery for a fresh one, then left for lunch to let the new power supply charge.

Left alone in the lab, RoboSimian’s battery did what such batteries famously do: went boom. Plumes of smoke vented from the robot’s exposed torso, followed by a burst of flame. Fire filled the room, then stabilized at the size of a toxic campfire. Gather round the burning bionic monkey, everybody. (Don’t.)

Exploding lithium-ion batteries are not new news. Last year’s hottest Christmas present, the hoverboard, was a bit too hot. You can’t take an e-cigarette on a plane because it might combust in the cargo hold. And if you have a Samsung Galaxy Note 7…well…better luck in your next phone pick.

But the magnitude of RoboSimian itself—and that of other lithium-powered NASA projects—set its battery fire apart. “In general, a single lithium ion cell is dangerous, but it can’t cause a gigantic explosion,” says Jay Whitacre, a Carnegie Mellon professor of materials science and engineering who used to do battery science at the Jet Propulsion Laboratory. Cell phones typically have a single cell; RoboSimian had 96. If you’ve seen what a Samsung device can do to your hand, imagine what this robot could have done to the rest of you.

And because NASA builds lithium-loaded vehicles that also go to space—sometimes, someday taking people up there—this fire may feel like cause for concern. The huge sets of cells that live inside robots, spacecraft, and robotic spacecraft? “That’s a lot of energy that’s released very quickly, and it can be fatal,” says Whitacre. “The more you put in one place, the more you have to look at it.”

Pay your interns

According to a presentation that Lynne Lee, the laboratory’s mishap program manager, made earlier this month to senior management, RoboSimian’s boom packed the power of a stick of dynamite. “If you notice where that fire came out, it was exactly where our researchers were standing,” Lee said, as she prepared to share lessons learned as the October Safety Message. “It could have been a very bad day.”

After the initial battery burst, an intern from the next lab over climbed through a window and sprayed RoboSimian with a CO2 fire extinguisher. But the fire persisted—he needed water to quench this combustion, despite NASA’s safety protocol, which called for a Class D extinguisher (no such extinguisher was around, anyway).

Another intern called the fire department. Firefighters, with the benefit of breathing masks, eventually rolled RoboSimian outside by a handle, like some kind of Mad Max Radio Flyer, and killed the fire with water.

So what actually happened here? The final report on why the fire erupted in the first place isn’t ready, says Brett Kennedy, head of the RoboSimian project. But they do have some details about The Incident.

Lithium-ion batteries have a positive side (anode) and a negative side (the cathode), separated by a liquid electrolyte, which is highly flammable. When the battery is charging, ions move from the positive side to the negative side. “When you charge a battery, you put a current through it,” says Whitacre. “And you do it until the battery hits its max voltage. When it hits its max voltage, you should stop that current.” If you don’t halt that flow, the battery can fail and, sometimes, explode.

Kennedy says the battery itself, as a whole, was not overcharged. “There was a monitoring system in place that continuously monitored the overall battery voltage and current,” he says. “Had either the voltage or current to the battery moved out of specification, the charging would have been shut down.”

But based on initial analysis, one cell of the battery was damaged and sent misleading information to the monitoring equipment. As a result, individual cells became overcharged—and kablooie.

While Whitacre couldn’t confirm or deny a specific hypothesis—his evidence coming only in the form of this non-forensic video—he did notice one thing: It all happened fast, not in the slow-burn way of many battery fires.

“Battery packs are made up of a number of smaller cells. It’s common for one of the cells to go a little haywire first,” he says. That cell damages its neighbors, and then they go nuts, and the mess cascades. “This one is a little bit different,” Whitacre continues. “It looks to me like almost everything went at the same time or like one of the cells got very, very hot very quickly.”

A booming industry

Lithium-ion batteries are “an essential part of power in NASA,” Lee said in her presentation. They’re on the Curiosity rover, the OSIRIS-REx craft that just launched itself to an asteroid, the Juno Jupiter mission, and the space station, as well as other current and future ventures.

Plus, adds Whitacre, they’re incredibly common in the aerospace sector generally and satellites in particular.

These batteries make good aerospace solutions because they pack wallops of energy relative to their size, hold a high amount of charge over their lifetime, and don’t lose that charge quickly when left alone. That’s exactly what you want in a space battery, which has to live long and prosper in the vast, empty off-Earth.

And so on systems that actually fly, NASA’s batteries undergo tons of oversight, from procurement to test after test after test. If a battery had inherent flaws, says Whitacre, engineers would know long before it went to space. “I’d be surprised if we ever saw this kind of thing occur in a flight project,” he says.

But if a battery cell or its management system happened to fail—or, as in RoboSimian’s case, failed to foresee a problem because of one cell’s faulty readings—a spacecraft may have inadequate shielding to contain the potentially resultant explosion. Shielding is heavy and every ounce counts when you’re trying to heft stuff to space.

RoboSimian is a non-flight technical project, and JPL is currently looking at how it can be used to “assemble orbital structures, like super big telescopes,” says Kennedy. If future ape-y robot ever went to space, it would go through the full zoo of tests. But because this particular robot wasn’t meant to fly, it—and all other ground-based NASA projects—was subject to less rigor. On top of that, some agency protocols are out-of-date, Lee said in her presentation, before stating that the agency needs to improve and update.

Because you know what they say: With great power comes great responsibility.