Yes — despairing of Allah's mercy is itself counted among the major sins, because it misrepresents who Allah is. When Ya'qub (Jacob) counseled his sons, he said, 'and despair not of relief from Allah. Indeed, no one despairs of relief from Allah except the disbelieving people' (12:87) — tying despair directly to a failure of faith in Allah's nature. Ibrahim (Abraham) said something similar when questioned about hoping for a child in old age: 'And who despairs of the mercy of his Lord except those astray?' (15:56). This matters practically because despair is often what keeps a sinner sinning — if you believe you're already too far gone, there's no reason to stop. Shaytan uses this against people constantly, whispering that their sin is too repeated, too shameful, or too old to be forgiven. But Allah's warning against despair is really a mercy in itself: it tells a struggling person that whatever they've done, giving up hope is the one response guaranteed to make things worse, and turning back is always still available.
Q&A · Repentance & Sin
Is losing hope in Allah's mercy actually considered a sin?
Informational, not a personal fatwa. Consult a qualified scholar for rulings on your situation.