NASA’s Kepler Space Telescope is the spacecraft that just won’t quit. Despite a series of setbacks in recent years, it continues to operate and return valuable data on potential exoplanets. That almost came to an end last month when the telescope fell back to emergency mode after what appeared to be a complete systems failure. NASA engineers worked diligently and managed to snatch victory from the jaws of defeat.

It all started in the wee hours of April 8th when Kepler mission manager Charlie Sobeck was awoken by a phone call. The telescope was locked in “emergency mode” and would be dead soon if NASA couldn’t fix it from millions of miles away. The longer the spacecraft is in emergency mode, the more fuel it burns, and it’s orbiting the sun more than 70 million miles away from Earth. There won’t be any refueling missions.

The failure occurred when Kepler was being reoriented as part of its K2 mission. This was undertaken after the second of its four reaction wheels failed in 2013. With only two wheels, the telescope couldn’t remain pointed at target stars to watch for signs of exoplanets. However, the K2 mission uses the two remaining wheels to balance the craft against the force of the solar wind to keep it stable for limited observations of stellar phenomena and potential exoplanets. However, instead of nudging itself into a different orientation for these observations, the telescope was one step away from total shutdown.

Kepler several operational modes including normal, safe mode, and emergency mode. If something goes wrong, Kepler would usually kick over to safe mode, but emergency mode happens when the satellite thinks all of its instruments have failed. While in emergency mode, it shuts down the main computers and fires the thrusters to keep the solar panels pointed at the sun. This ensures NASA will be able to contact the spacecraft, but time (and fuel) is extremely limited.

The first step in saving Kepler was to get in contact with it. NASA was able to declare a “space emergency” to gain immediate priority access to the Deep Space Network of communications antennas located around the globe. Kepler’s emergency backup communications array was only pointed back at Earth every few hours, so it took three days to figure out what had happened. Kepler reported that its thrusters, primary communication hardware, and two remaining reaction wheels had all failed. NASA wasn’t buying it. The odds of all those systems failing simultaneously were slim.

NASA was able to remotely stop the spinning, offering consistent communication. Then, they rebooted the telescope. Sure enough, the failed systems came back online without the false alarms. NASA doesn’t know what caused the telescope to think all those systems had failed, but they managed to fix the problem before all the fuel was exhausted. It did still burn through quite a lot, though. NASA is still working to estimate the fuel levels, but it’s likely part of the K2 mission will have to be cut short.