I found it, it's a bug in KoLmafia, not my script.
The bug goes like this: Each adventure at the Lucky sewer decrements KoLmafia's counters for Adventures and Chewing Gum twice. So the first time through the loop, it works but it ends up with an inventory count of -1 chewing gum. My script...