Boeing Co. said it would return its Starliner spacecraft to a factory for “deeper-level troubleshooting” to fix stuck valves that have delayed a planned launch this summer until perhaps next year.

The decision to remove the Starliner from atop the rocket that was supposed to propel it into space is expected to delay its launch by several months. Boeing and NASA officials said Friday it was too soon to predict whether the launch—a redo of a failed attempt in 2019—would occur this year.

“We’re going to go fix this problem,” associate NASA administrator Kathy Lueders said. “The team needs some time now to really be able to figure out what’s wrong.”

Boeing said its preliminary analysis indicated that moisture in the spacecraft’s propulsion system somehow resulted in corrosion on 13, or more than half, of certain valves and prevented them from opening properly, according to John Vollmer, a company executive who oversees the Starliner.

After years of cost overruns, errors and delays, Boeing’s space program is facing a major test: Later this year it will likely make its second attempt to launch its Starliner crew capsule to the International Space Station. WSJ looks at the company’s path to this crucial moment, and what’s riding on the test flight’s success. Illustration: Alex Kuzoian/WSJ The Wall Street Journal Interactive Edition

The valves open and close to allow—or stop if needed—the flow of certain chemicals used to propel the spacecraft at various stages of the mission and are key to its safety.

Mr. Vollmer said Boeing hadn’t identified the moisture’s source. Nine of the 13 valves are back to functioning normally, with four still closed, the company has said.

Mr. Vollmer added that Boeing would evaluate whether the problematic valves would require a redesign. He also flagged a separate problem with sensors that indicate whether the valves are open or closed. A storm also displaced covers over the spacecraft’s thrusters, resulting in water intrusion, he said.

The valves were used on the 2019 Starliner flight that didn’t reach the space station, but weren’t the cause of that mission’s mistakes, according to Mr. Vollmer. He also said they had been tested previously without any incident. When the vessel was on the launchpad for the most recent flight attempt last week, Boeing checked the valves as part of its testing procedures and discovered the problem, he added.

“These are the kinds of things you want to find on the ground,” said Ms. Lueders.

The propulsion system containing the valves is manufactured by Aerojet Rocketdyne Holdings Inc., a longtime Boeing supplier that officials said was assisting in the troubleshooting and repairs. The company declined to comment Friday.

Earlier in the week, Boeing and NASA had said they were weighing potentially launching the Starliner this month. NASA has other missions planned in coming months that complicate scheduling future attempts to launch the Starliner.

Boeing has spent years developing the Starliner and was supposed to launch it late last month to dock with the International Space Station, without crew on board—after the earlier attempt a year and a half ago. Ultimately, the capsule is supposed to ferry astronauts and cargo to the space station.

Ahead of the Starliner do-over this summer, NASA and Boeing officials in July said they had subjected the spacecraft to rigorous, increased testing to ensure a successful test. The company previously booked a $410 million charge related to the costs of the launch redo. Mr. Vollmer said Friday that it was too soon to say how much the latest delay might cost Boeing.

After the Starliner is removed from the rocket, the spacecraft will be moved to a factory at the Kennedy Space Center in Florida, he said.

In December 2019, a Boeing software error prevented the Starliner from getting into the correct orbit and it never docked with the space station. Another potentially catastrophic error was fixed during the mission to prevent damaging the spacecraft’s protective heat shield.

NASA has said it wants to have two U.S.-based companies available to transport astronauts to and from the space station. Right now, the agency has one confirmed provider, SpaceX, in place for those flights. Its second option is to contract for seats on Russian rockets.

On Friday, NASA officials and Mr. Vollmer said they were disappointed by the Starliner’s lengthy delay but stressed that a schedule wasn’t their primary concern.

“The launch window, while important to us, was not the driver,” Mr. Vollmer said. “The driver was safety.”

Write to Andrew Tangel at Andrew.Tangel@wsj.com and Micah Maidenberg at micah.maidenberg@wsj.com