Barcelona almost ruined promising midfielder Ilaix Moriba's contract renewal when they sent their final offer to Espanyol instead of his agent, sources from both clubs have confirmed to ESPN FC.

Espanyol were left "gobsmacked" at the figures being offered to the 16-year-old -- and a source jokingly told ESPN FC that the teenager "will earn more than some of their first team players."

Ilaix is one of the most highly rated players coming through Barca's La Masia academy. Leading up to his 16th birthday in January, he had a range of offers from around Europe to leave Camp Nou.

Barca had to go out of their way to try and keep him. A source at the club revealed to ESPN FC that, once the new deal is signed, which should be soon, he will become one of the academy's top-ever earners.

However, after finally getting close to an agreement with Ilaix and his agent, things almost went wrong, as the final proposal was mistakenly sent to Espanyol's technical director instead of the agent.

Luckily for Barca, Espanyol let their city rivals know that they had made a mistake, allowing them to send it on to the necessary people.

Ilaix plays for Barca's under-19 team but, as part of the new deal, is expected to be promoted to the B squad next season. He will not play again this season, though, after getting injured while on international duty with Spain U19s recently.

Barca and Espanyol meet in La Liga this weekend at Camp Nou in the Catalan derby. Ernesto Valverde's side are 10 points clear at the top of the table, with Rubi's men sat safely in 13th place.