TL;DR: Building humor into your habits for spotting and correcting errors makes the fix more enjoyable, easier to talk about and receive social support, and limits the danger of a contempt spiral.
One of the most reliably bad decisions I've made on a regular basis is the choice to stay awake (well, "awake") and on the internet past the point where I can get work done, or even have much fun. I went through a spell where I even fell asleep on the couch more nights than not, unable to muster the will or judgement to get up and go downstairs to bed.
I could remember (even sometimes in the moment) that this was a bad pattern, but, the more tired I was, the more tempting it was to think that I should just buckle down and apply more willpower to be more awake and get more out of my computer time. Going to bed was a solution, but it was hard for it not to feel (to my sleepy brain and my normal one) like a bit of a cop out.
Only two things helped me really keep this failure mode in check. One was setting a hard bedtime (and beeminding it) as part of my sacrifice for Advent. But the other key tool (which has lasted me long past Advent) is the gif below.
The poor kid struggling to eat his ice cream cone, even in the face of his exhaustion, is hilarious. And not too far off the portrait of me around 2am scrolling through my Feedly.
Thinking about how stupid or ineffective or insufficiently strong-willed I'm being makes it hard for me to do anything that feels like a retreat from my current course of action. I want to master the situation and prove I'm stronger. But catching on to the fact that my current situation (of my own making or not) is ridiculous, makes it easier to laugh, shrug, and move on.
I think the difference is that it's easy for me to feel contemptuous of myself when frustrated, and easy to feel fond when amused.
I've tried to strike the new emotional tone when I'm working on catching and correcting other errors. (e.g "Stupid, you should have known to leave more time to make the appointment! Planning fallacy!" becomes "Heh, I guess you thought that adding two "trivially short" errands was a closed set, and must remain 'trivially short.' That's a pretty silly error.")
In the first case, noticing and correcting an error feels punitive, since it's quickly followed by a hefty dose of flagellation, but the second comes with a quick laugh and a easier shift to a growth mindset framing. Funny stories about errors are also easier to tell, increasing the chance my friends can help catch me out next time, or that I'll be better at spotting the error just by keeping it fresh in my memory. Not to mention, in order to get the joke, I tend to look for a more specific cause of the error than stupid/lazy/etc.
As far as I can tell, it also helps that amusement is a pretty different feeling than the ones that tend to be active when I'm falling into error (frustration, anger, feeling trapped, impatience, etc). So, for a couple of seconds at least, I'm out of the rut and now need to actively return to it to stay stuck.
In the heat of the moment of anger/akrasia/etc is a bad time to figure out what's funny, but, if you're reflecting on your errors after the fact, in a moment of consolation, it's easier to go back armed with a helpful reframing, ready to cast Riddikulus!