The apparent contradiction disappears once the two passages are read as speaking about different situations. Shirk is not forgiven for a person who dies persisting in it, but a person who repents from it before death may be forgiven - as the Israelites were.

The strongest form of the objection

The objection has real force if the verses are read without qualification. The Israelites did not merely commit a minor error: they took the golden calf as an object of worship. That is shirk, the very sin Islam treats as the gravest possible violation of tawhid. Yet the Quran says that Allah pardoned them:

And when We appointed Moses thirty nights and completed them with ten, so the term of his Lord was completed as forty nights. And Moses said to his brother Aaron, "Take my place among my people, do right, and do not follow the way of the corrupters." And when Moses returned to his people, angry and grieved, he said, "How terrible is what you have done in my absence. Did you impatiently await the command of your Lord?" And he threw down the tablets and seized his brother by the head, pulling him toward himself. Aaron said, "O son of my mother, indeed the people oppressed me and were about to kill me, so do not let the enemies rejoice over me and do not place me among the wrongdoing people." He said, "My Lord, forgive me and my brother and admit us into Your mercy, and You are the most merciful of the merciful." And those who took the calf - wrath from their Lord and disgrace will overtake them in this world. Thus do We recompense those who invent falsehoods. But those who commit sins and then repent thereafter and believe - indeed, your Lord thereafter is Forgiving and Merciful.

Quran 7:142-153

So, the argument says, either 4:48 is false, or the calf worship was somehow not shirk. The first option creates a contradiction; the second weakens the plain meaning of the story.

What Quran 4:48 actually means

Indeed, Allah does not forgive association with Him, but He forgives what is less than that for whom He wills. And whoever associates others with Allah has certainly fabricated a tremendous sin.

Quran 4:48

The verse is addressing the final state of a person who meets Allah while persisting in shirk without repentance. It is not saying that repentance from shirk is impossible. If it did, the Quran's repeated calls for idolaters to repent would be meaningless.

This is also how the classical commentators understood it. Shirk is unforgiven when carried into death unrepented; sins less than shirk remain under Allah's will. But whoever abandons shirk, believes sincerely, and returns to Allah may be forgiven. Conversion itself demonstrates this principle: people who lived in idolatry before Islam are not permanently condemned for it after genuine repentance.

Why the golden calf does not contradict this

And when We took the covenant of the Children of Israel: "You shall worship none but Allah." Yet they took the calf after Moses, and they were wrongdoers. Then We pardoned you after that so perhaps you would be grateful.

Quran 2:51-52

The passage explicitly says they were pardoned after the sin, not that Allah forgave unrepentant shirk while they continued in it. The surrounding account describes their remorse and a severe commanded act of repentance, after which Allah accepted them. Quran 4:153 likewise says that, despite their grave demand to see Allah openly and their worship of the calf, Allah pardoned them.

Therefore, the example establishes Allah's willingness to forgive even shirk when a person truly repents. It does not establish that shirk is forgiven without repentance, nor that Quran 4:48 is mistaken. The objection identifies the sin correctly, but it overlooks the condition that separates the two rulings: persistence until death versus sincere repentance before it.