DataStore:GetVersionAsync() keeps throwing 500/502 errors

Hello! I’m trying to use :GetVersionAsync() to rollback one of my play testers’ data due to it miss-migrating as far as I can tell when I tried to update the game to add more stuff to save.

This is the snippet I’ve tried using for going through older versions of their saves:

local MaxDate = DateTime.now().UnixTimestampMillis
local MinDate = MaxDate - 86400000 * 2

local Pages:Pages = PlayerDataStore:ListVersionsAsync(TargetId, Enum.SortDirection.Descending, MinDate, MaxDate, 10)
local Page = 0
while not Pages.IsFinished do
	for i, v in ipairs(Pages:GetCurrentPage()) do
		local Data = {}
		local Got
		repeat
			local Succ, Why = pcall(function()
				Got = PlayerDataStore:GetVersionAsync(TargetId, v.Version)
			end)
			if not Succ then
				print(Why)
				continue
			end
		until Succ

		if Got then
			Got = DecodeBinaryString(Got)
			DecodeSave(Data, Got)
		end
		if #Data.Characters > 0 then
			warn(Page * 10 + i)
			warn(Data)
		else
			print(Page * 10 + i)
			print(Data)
		end
	end
	Page = Page + 1
	Pages:AdvanceToNextPageAsync()
end

print("Complete!")

and this is the error I get after exceeding their 13th backup:
502: API Services rejected request with error. HTTP 500 (Internal Server Error)

Don’t worry about the functions I use for compressing and decompressing, they aren’t the problem.

Know that I compress everything into binary strings so there can be things like NULL characters etc. and other control characters within the save but none of them ever exceed 127 incase that effects anything!

1 Like

Upon further testing I’ve realized everything past 13 is expired and after I asked them to play some more the number increased to 18.

Why’d roblox store expired version keys and is there a better solution than assuming the version key must be expired if the error that is thrown is a 502?