NEW YORK (Reuters) - American Airlines has reached an agreement with its pilots union over premium pay for some December flights, both groups said on Friday, after a scheduling snafu gave too many pilots holiday time off and sent the airline scrambling to correct its mistake.

FILE PHOTO : An American Airlines Boeing 757 aircraft takes off at the Charles de Gaulle airport in Roissy, France, August 9, 2016. REUTERS/Jacky Naegelen

“We are pleased to report that together, American and the Allied Pilots Association have put that worry to rest to make sure our flights will operate as scheduled,” American Airlines said in a statement.

An error in the system that bids for pilots’ time off based on seniority was responsible for approving too much time off to too many pilots in December, American disclosed to employees last week, launching the carrier into a frenzied effort to cover thousands of then-pilotless scheduled flights.

American had offered its pilots 150 percent of their hourly pay rate to pick up certain flights in the busy holiday period, but APA complained that restrictions on premium pay and the ability to trade trips were in violation of the group’s contract.

“With this agreement in principle, we anticipate that American Airlines will be able to maintain a full December schedule as planned for its passengers,” the Allied Pilots Association (APA) wrote in a statement to its members.

At its peak, APA estimated that more than 15,000 flights did not have pilots scheduled to fly them.

By Thursday, only a few hundred flights remained unstaffed, American said. The carrier expects that number to continue to decrease, and it has not had to cancel any flights as a result of the error.

Both APA and American declined to detail the exact nature of the agreement, but the deal comes at a time when airlines’ rising labor costs are in the spotlight.

Earlier this year, a substantial mid-contract pay increase for American’s pilots and flight attendants spooked investors and temporarily sent the carrier’s shares tumbling.

The carrier’s shares closed down 2.95 percent at $49 on Friday.