508: Exhausted all retries for key: %s DataStore

i recently started getting 508 error when i am trying to save players data.

local DataStoreService = game:GetService("DataStoreService");
local GetDataStore = DataStoreService:GetDataStore("adawdaw");

function PlayerAdded(Plr)
	local leaderstats = Instance.new("Folder",Plr);
	leaderstats.Name = "leaderstats";
	
	Stat.Name = "Seat";
	Stat.Value = "";
	Stat.Parent = leaderstats;

	local Data;

	local Error,Done = pcall(function()
		Data = GetDataStore:GetAsync(Plr.UserId);
	end)

	if (Data) then
		Stat.Value = Data[1];
	end
end

function PlayerRemoving(Plr)
	pcall(function()
		GetDataStore:SetAsync(Plr.UserId,{Plr.leaderstats.Seat.Value});
	end)
end

game.Players.PlayerRemoving:Connect(PlayerRemoving);
game.Players.PlayerAdded:Connect(PlayerAdded);

i know there is post about this already but i did not found any useful information from it.

Then what do you hope to gain by making a new thread? :confused:

3 Likes

i am deleting it but i have no perms so i just flagged it moderators should delete it soon.

508 is a Resource Limit Reached error. Means the server has exhausted all resources allocated to that specific task.

%s is the character class for a space.

While the database won’t be using Lua internally; it seems like your userId key is being serialized into a space character at some point in the network pipeline. The server is then retrying too many times to save to a whitespace key, which some things won’t allow.

Have you tried using a few prefix characters concatenated to the userid to enforce a non-numeric leading string? This is how userid keys are represented in every example in the wiki; so I’ve always assumed that was to prevent serialization and stuck to that format.

Eg:

local key = ''id_' .. Plr.UserId```

iv never tried that i just do

local key = Plr.UserId

I just noticed the other thread with this identical problem. It is also using numeric character leading keys, which strengthens my serializiation suspicion. Give the concatenation thing a try and see if that fixes it.

for example like this?

Data = GetDataStore:GetAsync('id_'..Plr.UserId);

Testing

Yep just like that. Sometimes things will not allow for strings to start with numbers.

image same thing.

Really can’t work off of the information you have, since it’s relatively limited.

  • Where are you experiencing this issue, in production data stores or within Roblox Studio?
    • If it’s Roblox Studio, do you have API Access enabled?
  • Do you have AutomaticRetry enabled in the DataStoreService?
  • Did your previous thread (unsure why you created a new one though) not solve your issue, especially noting buildthomas’ post that 5xx codes are internal errors and not something you can handle? Have you tried filing a bug report if this is confirmed an issue?

In other news though, I have a bone to pick with your code.

-- Original
	local Data;

	local Error,Done = pcall(function()
		Data = GetDataStore:GetAsync(Plr.UserId);
	end)

-- New
	local success, data = pcall(function)
		return GetDataStore:GetAsync(Plr.UserId)
	end)

	if success and data then
		-- whatever
	end

-- Old
function PlayerRemoving(Plr)
	pcall(function()
		GetDataStore:SetAsync(Plr.UserId,{Plr.leaderstats.Seat.Value});
	end)
end

-- New
function PlayerRemoving(Plr)
	local success, response = pcall(function()
		return GetDataStore:SetAsync(Plr.UserId, {Plr.leaderstats.Seat.Value});
	end)
end

Furthermore, are you experiencing this issue on any other projects of yours or is it limited to this one alone? Have DataStores worked before in this project or not?

no it happened in 2 games.

Also i appreciate for helping and making my code more clear :heart:.

1 ) i am experiencing this issue in studio and Api Access is enabled.
2 ) no i dont have any AutomaticRetry enabled in DataStoreService

Please respond to my entire post. A single sentence response is not going to give me any new information to observe.

Please search before posting, try not to file duplicate support threads about the same issue.

1 Like