Wrong error message when calling GetSortedAsync with a pageSize of 0


When attempting to call GetSortedAsync on an OrderedDataStore, and you pass 0 for the pageSize parameter, the request errors with a generic internal error message rather than the error message that usually appears for the pageSize being out of range.


  1. New file and publish it to a live place with Studio API access / live edit a place with Studio API access.
  2. Add a Script object to ServerScriptService.
  3. Set its contents to:
local ds = game:GetService("DataStoreService"):GetOrderedDataStore("_TEST")
ds:GetSortedAsync(true, 0)
  1. Press Play.
  2. Observe Output.

Observed Behavior:

This error message appears:

502: API Services rejected request with error: ApiClient GamePersistenceApiClient exception:

Url = http://gamepersistence.api.roblox.com/v1/GetSortedValues

StatusCode = InternalServerError

StatusDescription = Internal Server Error

None of this describes what actually went wrong to the developer.

Desired Behavior:

A clear error message that indicates the page size should be between 1 and 100 inclusive in the case that pageSize = 0 is passed to GetSortedAsync.

No web request should be made when a page size of 0 is passed similar to what happens when a page size < 0 or > 100 is passed.

See also:

1 Like