Error code 107 from OrderedDataStore:GetSortedAsync?

In the last week or two I started seeing this error show up in my logs:

107: MaxValue must be greater than or equal to MinValue.

The stack trace shows it’s the last line of this.

local isAscending = true
local pageSize = 100
local minValue = os.time()
		
local pages = DataStore:GetSortedAsync(isAscending, pageSize, minValue)

I use OrderedDataStores with values being the current time when I want to retrieve recent data, like ads that were run in the past 3 days.

The weird part is that I haven’t modified any of this code in a year. I’m theorizing that os.time() surpassed some value where now it throws an exception if no maxValue is passed into the method. It doesn’t happen in Studio but it happens 100% of the time in running game servers, so I suspect there’s some subtle difference with how it’s done in Studio vs live games.

This error isn’t documented on the developer hub. https://developer.roblox.com/articles/Datastore-Errors

Edit: When I pass in an arbitrarily high maxValue like 9223372036854775807, the query works fine.

2 Likes

Passing in a maxValue makes the query work. My hunch is that GetSortedAsync() sets a default for maxValue to some arbitrary number like 1550000000. Seems like a bug.

3 Likes

Someone had a similar issue before. I believe you do have to specify a maxValue if you specify a minValue. Given there are no defaults for either value, not including an argument for minValue or maxValue assigns them to nil. If you specify minValue, then maxValue is still nil. Any number is greater than nil. Try specifying a maxValue.

This error definitely has nothing to do with os.time(). I posted a thread earlier because this one didn’t come up, but I also started receiving this at the same time. In my case, I specified 1 as the minValue, so it seems like for some reason maxValue is defaulting to a lower number when minValue is specified. I don’t have any more details on what exactly could be going on besides that.

Thanks for raising this – we will be reverting the update and investigating.

3 Likes

Thank you. Always good to hear back from a Roblox staff member :slight_smile:

1 Like