Spain spent $276 million on trains before it became clear they were too big for local tunnels, Business Insider reported. 

Spanish transportation officials are going back to the drawing board after losing millions of euros on new commuter trains.

Two high-ranking Spanish transportation officials were fired earlier this week after local news outlet El Comercio reported that the government spent 258 million euros (about $276 million) on unfit trains.

The 31 trains were to replace old trains in northern Spain, a route that connects the regions of Cantabria and Asturias.

Cantabrian President Miguel Ángel Revilla called the circumstance a terrible mistake, according to local newspaper El Diario Montañés.

Renfe, the country's national rail operator, ordered the trains in 2020, awarding the contract for production to transport company CAF.

According to Euronews, Renfe said it had provided the correct dimensions from the rail company Adif, but the manufacturers said they had warned the national rail line that the dimensions were likely wrong.

The miscommunication probably arose because the tunnels in the region were built in the 19th century, so they do not match the modern standard train sizes.

Fortunately, according to the country's transportation minister, the trains were still in the design stage and had not yet been built when the mistake was discovered. They were supposed to be available in 2024. However, a complete redesign means that the new service won't be available until 2026.