DataStores: Set/Update requests silently fail with infinity/infinitesimals

If you try to save a number that is infinity or an infinitesimal (or a table containing one of those) to the DataStore, the request will silently fail. This means that if for whatever reason I end up with one of those types of numbers in my cache, all future updates to the DataStore will fail. It won’t set the key to nil, but it will result in the DataStore key never changing from its present state.

To reproduce:

  • Initialize a DataStore key to some non-default value (e.g. -1) so when you print out the key later you can tell that the issue is silent fails instead of keys being set to nil
  • Take any the following numbers: {10^-308, -3^-678, 3+(3^-32), math.huge, -math.huge}
  • Save your numbers to that key either with UpdateAsync or SetAsync
  • Print out the result each time, obtained through either GetAsync or UpdateAsync (to avoid cache issues)
  • Now try saving a table with normal data but include one of the above numbers
  • Check the key again and notice that the above request silently failed too
5 Likes

Can verify that this is still a problem years later — I’m having to script in an exception for a game pass which gives you infinite inventory slots.

I had this issue the last few days - it’s related to the number being treated as a number w/JSON encoding (Even though it should be saved as a string). It wouldn’t be wrapped in quotes for the json encoded version, and when trying to decode/load, it’d fail with a ‘Cannot parse JSON’ error.

image