This was a bug introduced in the API 2.3 Release as part of allowing retracting flags from the API. If you pass a flag id through
/flags/add that is possible to retract, it will retract it instead of throwing an error.
However, we accidentally added this retraction feature to earlier versions of the API. API consumers like the Charcoal user script that depended on getting an error when trying to add a flag the second time were now accidentally retracting flags. We've fixed this bug so that calls on the API before 2.3 will stop retracting flags and will instead continue to get an error response as previously expected.
With this new retraction feature, there was also an instance where certain API calls could accidentally retract other users flags, marking them as self-cleared. This could have also been the source of some flags getting mistakenly retracted. We also fixed this bug and you should no longer see your flags cleared like this.
I'm not personally familiar with the Charcoal userscripts, but if it gets upgraded to using v2.3 of the API, it will need to handle this new retracting feature when adding a flag for the second time. Right now, this functionality isn't documented in the API docs but is mentioned in this post. We'll work on getting this previously undefined behavior documented better in the change log and
/flags/add endpoints for v2.3. It's also possible that how retractions are done through the API may move away from the
/flags/add endpoint in a future release, but we're still figuring it out internally. We'll make sure to communicate any breaking changes in future release notes.