No contradiction between the two aayahs
Question

How can we reconcile between these two aayahs (interpretation of the meanings): “Verily, Allaah forgives not that partners should be set up with Him (in worship), but He forgives except that (anything else) to whom He wills” [al-Nisa’ 4:48] and “And verily, I am indeed forgiving to him who repents, believes (in My Oneness, and associates none in worship with Me) and does righteous good deeds, and then remains constant in doing them (till his death)” [Ta-Ha 20:82] Is there any contradiction between them?
Praise be to Allah.There is no contradiction between them. The first aayah refers to one who dies in shirk (associating others with Allaah) without having repented from it. He will not be forgiven and his abode will be Hell, as Allaah says (interpretation of the meanings): “Verily, whosoever sets up partners (in worship) with Allaah, then Allaah has forbidden Paradise to him, and the Fire will be his abode. And for the Zaalimoon (polytheists and wrongdoers) there are no helpers” [al-Maa'idah 5:72] “But if they had joined in worship others with Allaah, all that they used to do would have been of no benefit to them” [al-An’aam 6:88]  And there are many similar aayahs. The second aayah –   “And verily, I am indeed forgiving to him who repents, believes (in My Oneness, and associates none in worship with Me) and does righteous good deeds, and then remains constant in doing them (till his death)” [Ta-Ha 20:82 – interpretation of the meaning] – refers to those who repent. Similarly Allaah says (interpretation of the meaning): “Say: O ‘Ibaadi (My slaves) who have transgressed against themselves (by committing evil deeds and sins)! Despair not of the Mercy of Allaah, verily, Allaah forgives all sins. Truly, He is Oft‑Forgiving, Most Merciful” [al-Zumar 39:53] The scholars are agreed that this verse refers to those who have repented. And Allaah is the Source of strength.