Back to stories
Software Bugs
I accidentally set up an infinite retry loop and burned $340 in 4 hours
I was building a little side project with the OpenAI API. Nothing fancy, just a script that summarized Slack threads and posted them to a channel.
I had a try/except block that was supposed to handle rate limit errors gracefully. Except I forgot to add any backoff logic. Or a max-retry count. Or, you know, any kind of exit condition whatsoever.
Went to bed at midnight. Woke up at 4am to 47 emails from OpenAI billing and my credit card company. The script had been hammering the API non-stop for four hours, retrying failed requests approximately every 200ms.
$340. For summaries of Slack threads nobody asked for.
I have since learned what `time.sleep()` does.
247