This apparent contradiction comes from these two hadiths:
It is narrated on the authority of ‘Abdullah b. Mas’ud that the Messenger of Allah (ﷺ) observed: None shall enter the Fire (of Hell) who has in his heart the weight of a mustard seed of Iman. (Sahih Muslim 91b)
Narrated Abu Sa`id Al-Khudri: Allah’s Messenger (ﷺ) said, “When the people of Paradise have entered Paradise, and the people of the Fire have entered the Fire, Allah will say. ‘Take out (of the Fire) whoever has got faith equal to a mustard seed in his heart.’ (Bukhari 6560)
An Nawawi Reconciling These Hadiths

Translation: As for the statement of the Prophet: “He will not enter Paradise the one who has in his heart the weight of a mustard seed of pride,” there has been disagreement over its interpretation.
Al-Khattabi mentioned two views. The first is that what is meant is arrogance that leads a person to reject faith—such a person will never enter Paradise at all if he dies upon that.
The second is that the meaning is that there will be no pride left in his heart at the time he enters Paradise, as Allah said: “And We removed whatever was in their hearts of rancour.”
But both of these interpretations are distant from the intended meaning, because this hadith was mentioned in the context of prohibiting the well-known form of pride, which is exalting oneself above others, looking down on them, and rejecting the truth.
So it is not appropriate to interpret the hadith in a way that removes it from its intended meaning.
Rather, what appears correct is what was chosen by Qadi Iyad and others among the scholars: that such a person (who has a small amount of pride in his heart) will not enter Paradise without first being held accountable, if Allah chooses to hold him accountable.
It was also said: this is his punishment if Allah holds him accountable. But it may be that Allah treats him with generosity and does not hold him accountable at all. Yet he must enter Paradise eventually—either at first or later—after punishing some of those who committed major sins and died insisting on them. It was also said: he will not enter Paradise alongside the righteous in the first group.
As for the statement of the Prophet: “No one enters the Fire who has in his heart the weight of a mustard seed of faith,” what is meant is that they will not stay in the Fire for eternity like the disbelievers do. And the Prophet’s words “the weight of a seed” are in accordance with what has already been established regarding the increase and decrease of faith (eman).
Sharh Sahih Muslim By An Nawawi (2/91)
