Hi Marcus — thanks, that’s a real bug, and your three steps pinned it down exactly.
The Flow card isn’t failing to write. It sets the validity on the lock the same way the combination card does. The problem is what it can’t do: once a service PIN has been used up, the lock drops the validity back to 0 and the code is no longer there to make valid again. So “valid 5 times” armed an empty slot — and the card reported success, which is the worst part. Nothing told you it had done nothing.
Fixed in 2.6.7 (Test): before setting a validity, the app now asks the lock whether it still holds a service PIN. If it doesn’t, the card fails with a message pointing you at “Set service PIN and validity” — the card that sets a code and its validity in one step. That has always been the way to re-issue a guest code, and it’s exactly what worked for you in step 1. (The check is Z-Wave only for now; over Zigbee the app can’t yet tell reliably where the service code lives.)
One favour, if you hit it again: should the validity card ever report success while the old code still doesn’t open the door, grab a diagnostics report from the app’s settings. The app now records what the lock says about its service-code slot, and that would tell me whether your lock erases a used-up code or keeps it and simply refuses it. I couldn’t find that documented anywhere, and your report is the best chance to settle it.