Data Store Errors and Limits
Data Store Errors and Limits
Error Codes
Requests to Articles/Data store|data stores
, like all network calls, may occasionally fail due to poor connectivity or other issues. Wrapping data store commands in pcall()
will handle any errors and return a message with an error code that you can cross-reference in the following table.
Error Code | Error Message | Notes |
---|---|---|
101 | Key name can't be empty. | Check if the key input into the data store function is an empty string. |
102 | Key name exceeds the 50 character limit. | Check if the key input into the data store function exceeds a length of 50. |
103 | X is not allowed in DataStore | An invalid value of type X was returned by a bad update function. |
104 | Cannot store X in DataStore | A value of type X returned by the update function did not serialize. |
105 | Serialized value converted byte size exceeds max size 64*1024 bytes. | Character count in string cannot exceed 65,536 characters. |
106 | MaxValue and MinValue must to be integer | If you're passing a minimum or maximum value to OrderedDataStore/GetSortedAsync|GetSortedAsync() for an OrderedDataStore , both values must be integers. |
106 | PageSize must be with in a predefined range | The maximum page size for an OrderedDataStore is 100. |
301 | GetAsync request dropped. Request was throttled, but throttled request queue was full. | GlobalDataStore/GetAsync|GetAsync() request has exceeded the maximum queue size and Roblox is unable to process the requests at the current throughput. |
302 | SetAsync request dropped. Request was throttled, but throttled request queue was full. | GlobalDataStore/SetAsync|SetAsync() request has exceeded the maximum queue size and Roblox is unable to process the requests at the current throughput. |
303 | IncrementAsync request dropped. Request was throttled, but throttled request queue was full. | GlobalDataStore/IncrementAsync|IncrementAsync() request has exceeded the maximum queue size and Roblox is unable to process the requests at the current throughput. |
304 | UpdateAsync request dropped. Request was throttled, but throttled request queue was full. | GlobalDataStore/UpdateAsync|UpdateAsync() request has exceeded the maximum queue size and Roblox is unable to process the requests at the current throughput. |
305 | GetSorted request dropped. Request was throttled, but throttled request queue was full. | OrderedDataStore/GetSortedAsync|GetSortedAsync() request has exceeded the maximum queue size and Roblox is unable to process the requests at the current throughput. |
306 | RemoveAsync request dropped. Request was throttled, but throttled request queue was full. | GlobalDataStore/RemoveAsync|RemoveAsync() request has exceeded the maximum queue size and Roblox is unable to process the requests at the current throughput. |
401 | Request Failed. DataModel Inaccessible when game shutting down. | DataModel is uninitialized because game is shutting down. |
402 | Request Failed. LuaWebService Inaccessible when game shutting down. | LuaWebService is uninitialized because game is shutting down. |
403 | Cannot write to DataStore from studio if API access is not enabled. | API access must be active in order to use data stores in Studio. See the Articles/Data store|data stores article for instructions. |
404 | OrderedDataStore does not exists. | The OrderedDataStore associated with this request has been removed. |
501 | Can't parse response, data may be corrupted. | System is unable to parse value from response. Data may be corrupted. |
502 | API Services rejected request with error: X. | Error X occurred when processing on Roblox servers. Depending on the response, you may want to retry the request at a later time. |
503 | DataStore Request successful, but key not found. | The key requested was not found in the data store. Ensure the data for the key is set first, then try again. |
504 | Datastore Request successful, but response not formatted correctly. | Data retrieved from GlobalDataStore was malformed. Data may be corrupted. |
505 | OrderedDatastore Request successful, but response not formatted correctly. | Data retrieved from OrderedDataStore was malformed. Data may be corrupted. |
Limits
There are also limits applied to the data store model. If a game exceeds these limits, the Roblox engine will automatically throttle the game’s data store usage, causing data requests to take longer.
Server Limits
Each game server is allowed a certain number of data store requests based on the number of players present (more players means more data will be needed). Server limits are based on the kind of request being made.
Request Type | Methods | Requests per Minute |
---|---|---|
Get Requests | GlobalDataStore/GetAsync|GetAsync() |
60 + numPlayers × 10 |
Write Requests (limit is shared among all listed methods) | GlobalDataStore/SetAsync|SetAsync() , GlobalDataStore/IncrementAsync|IncrementAsync() , GlobalDataStore/UpdateAsync|UpdateAsync() , or GlobalDataStore/RemoveAsync|RemoveAsync() |
60 + numPlayers × 10 |
Get Sorted | OrderedDataStore/GetSortedAsync|GetSortedAsync() |
5 + numPlayers × 2 |
Request Type | Methods | Cooldown |
Write Requests (same key) | Repeated GlobalDataStore/SetAsync|SetAsync() , GlobalDataStore/IncrementAsync|IncrementAsync() , GlobalDataStore/UpdateAsync|UpdateAsync() , or GlobalDataStore/RemoveAsync|RemoveAsync() |
6 seconds between write requests |
DataStoreService/GetRequestBudgetForRequestType|GetRequestBudgetForRequestType()
. See the code samples for a script that displays the present budget for all data store methods.
Game Limits
There are also limits on how often an entire game (all of its active servers) can call data stores. In particular, requests to a specific key can be throttled if it’s being requested from too many servers at once. In this case, a key is defined by the combination of a data store’s scope, the store’s name, and the index being requested.
To avoid exceeding a game’s limits, you should only use data stores in two contexts:
- Saving player data
- Managing global configuration values
For player data, requested keys can be unique for each player (Player/UserId|UserId
is useful for this) so it’s unlikely you’ll hit any global limit.
For global configurations, if each server is simply reading a value that doesn’t change often, there’s little chance of hitting the threshold.
Data Limits
Along with the frequency of requests, data stores limit how much data can be used per entry. The key, name, and scope must all be under a certain character length, as well as the amount of data stored.
Component | Maximum Number of Characters |
---|---|
Key | 50 |
Name | 50 |
Scope | 50 |
Data | 4,000,000 |
string.len()
. Data is also saved as a string in data stores, regardless of its initial type. The size of data can be checked with the HttpService/JSONEncode|JSONEncode()
function that converts Lua data into a serialized JSON table.
Request Queues
When a limit is reached, further requests are placed into one of four queues: set, ordered set, get, and ordered get. Requests in a queue are handled in the order they are received and the called function continues to yield as long as its request is queued. If the data store key itself is throttled, the request is temporarily skipped but still in the queue. Each queue has a limit of 30 requests and, when this limit is exceeded, the requests fail with an error code in the 301–306 range indicating that the request was dropped entirely.