In 2017, a commercial airliner lined up for takeoff at San Francisco International Airport on runway 01 Left, the main departure route.

The pilot accidentally punched 10 Left — a much longer SFO runway — into the cockpit computer, causing the plane to incorrectly calculate the appropriate thrust and wing flap settings.

The pilot’s simple reversing of the number caused the plane to nearly run out of runway, lifting off with only 400 feet left of asphalt, according to a Federal Aviation Administration report obtained by The Chronicle through the Freedom of Information Act.

It wasn’t the only such close call at SFO. The March 2018 FAA safety report found 25 cases from 2014 to 2017 in which airplanes from several carriers took off with less than 1,000 feet of runway remaining. The FAA believes some of those cases probably were a result of “transposition error” and said no other major airport in the United States has had a similar problem.

Aviation experts say airliners need to lift off the ground with enough runway left to abort a takeoff — 400 feet isn’t nearly enough and 1,000 feet is too close.

“Wow, that is practically the end of the runway!” retired pilot Ross Aimer, an aviation consultant familiar with SFO, said of the 2017 incident. “They were lucky they didn’t take out some of the instrument landing equipment erected at the end of that runway.”

The runway 01 error revelations are the latest issue at the airport involving its runways, taxiways and tarmac. The airport closed its busiest runway, 28L, on Sept. 7 for 20 days of repairs, leading to more than 1,000 flight delays and hundreds of cancellations. The closure was not related to the runway number issue but resulted from deteriorating concrete.

Runway 28L was also closed overnight in July 2017 for construction, contributing to a near-catastrophic botched landing. An Air Canada Airbus A320 mistook a crowded taxiway for its runway and came within 14 feet of crashing into four fully loaded planes before pulling up and narrowly averting what could have been the worst aviation disaster in history.

The aborted landing prompted a National Transportation Safety Board investigation and a Government Accountability Office report published last month saying the FAA needs to do a better job collecting and analyzing data on ground incidents. Reported runway incursions across the country nearly doubled, from 954 in fiscal year 2011 to 1,804 in 2018, according to the report.

The SFO close call also led to a three-day FAA safety visit to SFO in late February 2018. At the time, SFO had experienced four wrong-surface events involving two or more carriers during the previous year, according to the FAA report.

The agency determined that the runway 10-01 confusion was “high risk” and issued a memo in September 2018 to pilot unions and other groups to alert flight crews and airlines of the issue.

“We have not received any reports about this kind of incident occurring at SFO since 2017,” FAA spokesman Ian Gregor said. Reporting such an incident is voluntary, so it’s unclear whether the confusion remains.

SFO spokesman Doug Yakel said he believes the issue has been fixed.

“We’re confident that the FAA has created the right environment with airlines to identify and resolve such issues,” he said.

The FAA said it is not identifying the airline involved in the 2017 incident to maintain the effectiveness of the confidential reporting system. Some details, however, were made public in the safety memo to airlines a year ago.

By registering runway 10L instead of 01L, the pilot made the computer system think it had 4,220 feet more runway than it actually had, investigators found. Runway 10L is 11,870 feet long; 01L is 7,650 feet. The computer alerted the captain to use the lowest thrust and flap settings, common for longer runways to reduce impact and wear on engines, the memo stated.

It resulted in a “takeoff with 400 feet of usable takeoff distance remaining,” the FAA memo concluded. A typical commercial airliner is traveling at 184 mph at liftoff, meaning the plane had about 1.5 seconds before reaching the end of the SFO runway.

After the incident, the airline reconfigured its planes’ computer systems, such as removing the slowest takeoff speed as an option at SFO.

There are no known crashes involving runway number transposition, but runway overruns often begin with simple mistakes. In 2006, Comair 5191 was cleared to depart from runway 22 at a Lexington, Ky., airport but instead lined up on runway 26, a much shorter runway. The plane struck a berm and crashed, killing 49.

In 2009, an Emirates flight crew accidentally entered its preflight weight as 262.9 tons, rather than the accurate 362.9 tons, while preparing for departure in Melbourne.

During takeoff the plane struggled to get airborne, causing the tail to strike the runway. It finally lifted off past the end of the runway, clipping airport equipment on its ascent.

That incident led the Australian government to conduct a study of pilots entering wrong information for takeoff. It found numerous incidents, including a wrong number entered because of a late runway change by air-traffic control, but no incidents of a pilot simply punching in the runway number backward.

Rep. Mark DeSaulnier, D-Concord, said his recent Safe Landings Act legislation would help the FAA conduct research into ways to reduce human error in aviation.

“In the aviation industry, a slight error can be fatal,” he said, “which is why the study of human factors is critical.”

While rare, the SFO takeoffs with only 1,000 feet left of runway are way too close, aviation consultant Aimer said.

“This is very dangerous. You always calculate that you’re able to stop on the runway if you abort,” he said in a phone interview. “If you have to abort, you wouldn’t have enough room, you’d run into the bay.”

Runway 01L operates southwest to northeast and ends with about 500 feet until water, but each SFO runway has crushable concrete blocks positioned at the end to slow down an airliner in an emergency. How far down a runway a plane should lift off depends on a number of factors, including type of aircraft, runway length, temperature, wind and weight, Gregor said.

Runways 10 Left and Right are the same strip of asphalt as runways 28L and R, but the opposite direction. Planes rarely take off from the 10s, only when the winds are from the south or in other unusual weather, Aimer said. In June, 80% of departures lifted off from runways 01L and R, according to SFO data.

The FAA suggested in its 2018 SFO safety report that the airport research whether renaming the runways was feasible to rid them of similar numbers. However, the numbers are determined by the magnetic orientation of the runway, essentially the compass degrees. For instance, runway 28 is 282.2 degrees, so the first two numbers are used to help orient pilots.

“Since this is such a deeply ingrained practice in aviation,” Yakel said, “we would only consider renumbering runways if there was an actual change to their magnetic headings.”

Aimer, a retired United Airlines captain, said entering the wrong runway number into the cockpit Flight Management Computer is rare, but can happen when pilots are tired, confused or at an unusual airport.

“As long as humans are doing the input, you are always bound to have mistakes, unfortunately,” Aimer said. “When it happens, it could be disastrous.”

Matthias Gafni is a San Francisco Chronicle staff writer. Email: matthias.gafni@sfchronicle.com Twitter: @mgafni