Data Store Errors and Limits
Data Store Errors and Limits
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
|106||PageSize must be with in a predefined range||The maximum page size for an
|301||GetAsync request dropped. Request was throttled, but throttled request queue was full.||
|302||SetAsync request dropped. Request was throttled, but throttled request queue was full.||
|303||IncrementAsync request dropped. Request was throttled, but throttled request queue was full.||
|304||UpdateAsync request dropped. Request was throttled, but throttled request queue was full.||
|305||GetSorted request dropped. Request was throttled, but throttled request queue was full.||
|306||RemoveAsync request dropped. Request was throttled, but throttled request queue was full.||
|401||Request Failed. DataModel Inaccessible when game shutting down.||
|402||Request Failed. LuaWebService Inaccessible when game 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
|404||OrderedDataStore does not exists.||The
|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
|505||OrderedDatastore Request successful, but response not formatted correctly.||Data retrieved from
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.
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|
||60 + numPlayers × 10|
||60 + numPlayers × 10|
||5 + numPlayers × 2|
||30 + numPlayers × 5|
|Write Requests (same key)||Repeated
||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.
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.
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|
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.
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.