The 4am Fix

By Steph12
Scroll to open
MOMENT

04:12, a Tuesday

The line that had been lying for six hours
python
# what I had been staring at since 22:00
if user.credits > 0 and item.in_stock:
    charge(user, item.price)

# what was actually happening
# charge() succeeded, the row never committed, and the except block
# below swallowed the rollback error into a log nobody was reading
except Exception:
    pass

Six hours on four characters

The fix was deleting two words. The six hours went on believing the code I had written, because it read correctly and the AI that helped me write it agreed that it read correctly. Neither of us was reading the log. A bare except that swallows everything is the most expensive thing you can ship, because it turns a loud failure into a quiet one and quiet failures are the ones that take until four in the morning.