Papal Infallibility was defined as an official doctrine during the First Vatican Council (1869-1870 AD), which was called by Pope Pius IX (1792-1878 AD).
The council, after much internal controversy, defined Papal Infallibility as follows:
Vatican 1 (1870 AD) - Infallible Teaching Authority of the Roman Pontiff
9 We teach and define as a divinely revealed dogma that when the Roman pontiff speaks Ex Cathedra, that is, when, in the exercise of his office as shepherd and teacher of all Christians, in virtue of his supreme apostolic authority, he defines a doctrine concerning faith or morals to be held by the whole church, he possesses, by the divine assistance promised to him in blessed Peter, that infallibility which the divine Redeemer willed his church to enjoy in defining doctrine concerning faith or morals.
Therefore, such definitions of the Roman pontiff are of themselves, and not by the consent of the church, irreformable.
So then, should anyone, which God forbid, have the temerity to reject this definition of ours: let him be anathema.
Note three things:
Until today, there is no consensus as to what exactly constitutes an Ex Cathedra statement. Typically, it is understood to be a statement, in an official declaration from the Pope, using language like the following:
Pope Boniface VIII - Unam Sanctam (1302 AD)
Furthermore, we declare, we proclaim, we define that it is absolutely necessary for salvation that every human creature be subject to the Roman Pontiff.
Pope Pius IX - Ineffabilis Deus (1854 AD)
We declare, pronounce, and define that the doctrine which holds that the most Blessed Virgin Mary, in the first instance of her conception, by a singular grace and privilege granted by Almighty God, in view of the merits of Jesus Christ, the Savior of the human race, was preserved free from all stain of original sin, is a doctrine revealed by God and therefore to be believed firmly and constantly by all the faithful.
Given this stipulation, there are only 6 or 7 statements that are agreed to have been Ex Cathedra, in the entire history of the Church. This is despite the history of hundreds of internal controversies, many of which persist through until today, within Catholicism. This is also despite having an entire Bible which needs to be interpreted, and which Catholics and non-Catholics waste many billions of hours every year arguing about the meanings of certain verses, all of which could be put to rest with an infallible Bible commentary. The "Vicar of Christ" can't be bothered. Rather, only once every 200 years, on average, does he actually do his job of infallibly teaching the Church.
Any impartial observer can reason as to why this is. The Church does not want the Pope to be subject to any real scrutiny. So, the definition of Ex Cathedra is never formally defined, and its scope is insisted to be very narrow, so that any and all contradictory or false things that Popes have taught on "faith and morals" can be excused as having not been infallible. If a Pope was wrong, he wasn't teaching infallibly - even when he clearly intended to teach on a matter of "faith and morals", in an official capacity, when he made the statement.
Pope John XXII (1244-1334 AD) generated internal controversy, especially amongst monastic orders in the Church, when he issued two Papal Bulls aimed at rejecting the idea that Christ and the Apostles had no possessions whatsoever - Ad Conditorem Canonum (1322) and Cum Inter Nonnullos (1323).
This doctrine of absolute poverty had arisen amongst the Franciscans, and they pointed back to the Papal Bulls Exiit Qui Seminat (1279 AD) and Exivi De Paradiso (1305, 1312 AD) for justification. In 1322 AD, the Franciscans issued encyclicals stating that the all declarations by the Pope were final, and could not be revoked.
As a result, Pope John issued Quia Quorundam, which clarified that he was not contradicting earlier Popes, but also that the doctrine that the Pope's declarations were irrevocable was false:
Pope John XXII - Quia Quorundam (1324 AD)
1 Because the father of lies is said to have so blinded the minds of certain men, that they by means of false madness have obscured Our constitutions—not without much punishable temerity, unless they retract and lean themselves once more upon the truth, which these contain—of which one begins: "Ad conditorem canonum," the other indeed: "Quum inter non nullos," arranged diligently by previously held deliberation certainly as much with Our brother Cardinals of the Holy Roman Church, as with many Archbishops and Bishops, and other prelates of the local churches, and not a few masters of sacred theology, and professors of both kinds of law [i.e. civil and canon], and promulgated on the counsel of Our aforementioned brothers: lest by daring [and] pernicious deeds their pestiferous doctrine shake the souls of the simple so much, and prevail to lead them into the deviation of their own errors, on the counsel of certain brother [cardinals]. We judge soberly to make provision concerning this matter, as follows [below].
Moreover, they have used as much as word as writing to dispute the aforesaid constitutions, for the alleged reason, as is shown: They say that "That which the Roman Pontiffs had defined by means of the key of knowledge, in faith and morals, once for all, persists unchangeable to such an extent, that it is not lawful for a successor to call it again into doubt, nor to affirm the contrary," although concerning those things, which have been ordained by means of the key of power, they assert it to be otherwise.
2 On account of which moreover, since it was previously mentioned in the aforesaid consideration, namely, that "It is not licit for their successors to call again into doubt those things, which were defined once for all by the key of knowledge in faith or morals by the Supreme Pontiffs, although it is otherwise," so they say, "in regards to those things, which have been ordained by the Supreme Pontiffs by [means of] the key of power," it is evidently clear from the following things [that] this is directly contrary to the truth.
The premise put forth by those that Pope John XXII is condemning is exactly the premise affirmed in Vatican 1 - that a Pope teaching on faith and morals cannot err. He ascribes such a doctrine to "the father of lies", that is, the Devil (John 8:44).
He then argues that Christ's words to Peter in Matthew 16:19 have nothing to do with knowledge, but rather authority.
This Pope, teaching on a matter of faith, in an official capacity, rejects the nascent Papal Infallibility which would come to be defined over 500 years later as a mandatory belief for all Christians, under penalty of Anathema. So, how can the Catholic Church hold the whole world, under penalty of Hell, to a belief that was explicitly rejected by a Vicar of Jesus Christ?
Often, when the Roman Catholic Church wants to define a doctrine, they will insist that it has "the unanimous consent of the Fathers", and has been "the constant and unanimous teaching of the Church". This is always false, and simply requires the Church to ignore whoever disagreed with them in the past, even if its unambiguous, and comes from a Pope or Ecumenical Council. This is especially true in the case of the Papal Infallibility.