Last week, American Airlines (NASDAQ:AAL) and its pilots union revealed that as many as 15,000 December flights didn't have a full crew of pilots assigned. This raised the specter of a reputation-busting surge in flight cancellations later this month.

Fortunately for its customers, American Airlines has reached an agreement with its pilots union that will keep its holiday flights in late December fully staffed. Unfortunately, the carrier had to pay a steep price to correct its error. This will extend its unseemly trend of rapid cost inflation.

American Airlines resolves its crew shortage issue

Airline crew scheduling procedures are extremely complex, particularly for large carriers. Pilots and flight attendants can put in detailed preferences for when and where they want to fly. Airlines have computer systems that reconcile those preferences with staffing needs, ensuring that every flight is fully staffed and that there are adequate reserve crews to account for potential delays, cancellations, illness, etc. More senior pilots and flight attendants have priority in terms of getting the schedules they want.

American Airlines' holiday staffing shortage was initially attributed to a computer glitch, but the company now says that a clerical error was the cause. The carrier mislabeled tens of thousands of late-December flights in an app that its pilots can use to customize their schedules. This allowed pilots to drop undesirable flights from their schedules in the second half of December.

An American Airlines jet on the ground

American Airlines has resolved its holiday pilot staffing crisis. Image source: American Airlines.

Initially, American Airlines offered to pay pilots 150% of their normal hourly wage for picking up open flights. It also planned to draw from its reserve pool to crew certain flights. However, the union cried foul over not having been consulted in the crafting of this solution. Additionally, the use of reserve pilots to fill in on flights without a full crew would have made it extremely difficult for American Airlines to recover in the event of bad weather.

Ultimately, it didn't take long for the airline and the union to reach an amicable agreement. American Airlines will offer its pilots double pay to pick up open flights during the second half of this month.

Paying up to fix problems is nothing new

It's good that American Airlines won't have to cancel lots of flights during the holiday season. This would have caused long-term damage to its reputation. On the other hand, it's not good that the company keeps spending freely to fix problems.

For example, American Airlines hired 1,900 extra employees two years ago to beef up staffing during the height of its merger integration process. The integration itself went smoothly, but the increase in head count and payroll never went away. More recently, American Airlines handed out big raises to its pilots and flight attendants to quell resentment among those employees, even though both work groups were under contract through 2019.

Viewed separately, all of these moves seem reasonable. However, in combination they have caused unit costs to spike higher since 2015, undermining American Airlines' profitability.

Margin deterioration continues

Through the first three quarters of 2017, American Airlines' pre-tax margin declined to 9.8% from 14.1% in the prior-year period. The company's margin decline will continue this quarter. Its official guidance calls for an adjusted pre-tax margin of 4.5%-6.5%, down from 7.9% in Q4 2016. That forecast may still be too ambitious because of a recent spike in jet fuel prices and the cost associated with offering double pay to pilots on certain holiday flights.

American Airlines expects non-fuel unit cost growth to slow dramatically after 2017. However, given how much unit costs have spiked in the past few years, that isn't very impressive. Furthermore, based on the recent price of jet fuel, American could face a 3-percentage-point margin headwind in 2018 just from higher fuel costs.

As a result, American Airlines will be hard pressed to get its profit margin moving in the right direction again in 2018. Perhaps 2019 will be the year that American's margin finally recovers. But based on the company's track record, it's possible that some other unforeseen problem will lead to additional cost inflation then.

Adam Levine-Weinberg has no position in any of the stocks mentioned. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.