I’ve been having this issue with custom filaments auto deleting (Aug 21,2024).
What I have discovered was that if two (or more) slicers were connected to the same printer (or account?) and I created a new filament in one of them while the other slicer(s) was still open, the other slicer instance doesn’t have the new custom filament in memory and I believe it is that instance that is deleting the filament from the AMS.
Closing the other slicers made the issue of self-deleting filaments stop occurring. The open instances of your slicer must have the filaments you’re trying to set in a printer’s memory or the slicer that is not aware of the custom filament, which I guess is loaded at startup, will clear the filament as invalid.
Unless devs provide a live solution, the “solution” is just to only add custom filaments with a single slicer window open.