It kinda depends on the character, the patron, and the class, but here's how I do it.
Clerics are devout, they worship a deity or a pantheon. This is a conscious act, a decision to follow a particular god or goddess and in return, they get to share in their power. However, in my campaign, the gods are distant...they don't monitor their temples and followers, and they honestly couldn't care less about what a mortal thinks of their agenda. (The clerics do not worship "divine policemen.") So a "grave offense" would be not maintaining the rituals, prayers, hymns, and other ceremonies at various shrines and temples. This corrodes their link to that distant power source...and therefore, they lose their powers. This is gradual at first: they lose a cantrip or two, or maybe a spell slot. But if they miss enough ceremonies and rites, and don't make enough offerings at the relevant shrines, they might lose their Channel Divinity and Spellcasting features altogether. They fix this by performing extra rituals, duties, and quests for their temple...or a new temple altogether. (In game-speak, this is a curse that can be broken by a side quest. It's also a convenient in-story way for a player to choose a new Domain for their cleric if their first choice isn't panning out.)
Paladins make oaths. They basically promise themselves that they are going to vanquish a particular entity, or uphold a particular ideal, or enforce a certain ethos. So the only "grave offense" they can commit are to themselves. This self-doubt affects their zeal, their faith, and their confidence, all of which will inhibit their ability to do their job. Without that fire, they don't have enough conviction and confidence to properly use their abilities. So a paladin who definitively, decidedly breaks their vow no longer has a subclass, and must undertake a side-quest to reaffirm it, or make a completely different vow. As with clerics, there are no Divine Police showing up and demanding they pay a fine or atone...instead, they must find their own way to reaffirm their faith. (In game-speak: this is never an accident or a consequence of dice rolls...this is always the player's choice. So, that said: if the player decides that they no longer want to be Oath of Vengeance, they lose their subclass until they complete a side-quest. At the end of that quest, they make a vow to the Ancients or whatever, and gain a different subclass.)
Warlocks make bargains: they have sold their soul to a powerful extraplanar entity in exchange for fast power. They did not bargain with a god, because remember that gods are distant in my campaign....but this being is still immortal and still powerful and is very interested indeed in protecting their interests. A warlock who displeases their patron can suffer any variety of consequences, depending on the patron and the terms of their contract. Typically: fiends might withhold their soul, making it unavailable to return to the warlock's body for the purposes of Raise Dead and other spells...the archfey will toy with the warlock like a cat toys with a mouse, sending monsters to fight them for their amusement or polymorphing the warlock and his friends into amusing creatures...the Great Old Ones will wrack the warlock's mind with nightmares and madness, sapping away their spell slots and imposing Disadvantage at random on rolls. All of these consequences will persist until the player finds a way to placate their patron, or buy out their contract. (In game terms: the warlock will undertake a side-quest on behalf of their patron, or on the behalf of a new one. Until they do so, they are subjected to a variety of penalties that both the DM and the player have agreed upon in advance.)
In all cases, Rule Zero applies. Nobody wants to play "gotcha" with a Table Tyrant.