List of Luau errors that aren't as well-known

This is a list of Luau errors that may not be well-known to you but may be very helpful in getting around some of these errors.

Function Error Cause
General Luau errors stack overflow (too many arguments) Called a function with 8,000 .arguments or more
‘__tostring’ must return a string __tostring metamethod did not return a string.
task.wait, task.spawn, task.defer Cannot call <task_func> on a thread that is already ‘waiting’ in the task library Attempting to resume a thread that called task.wait before Roblox could resume it. Interestingly, the deprecated wait function does not observe this behavior.
table.insert wrong number of arguments to ‘insert’ Did not call with 2 or 3 arguments.
table.concat invalid value <field_type> at index <field_key> in table for ‘concat’ One of the array fields is not a raw string or raw number. Metatables, whether it be the target table or any of the fields, are not supported.
table.unpack too many results to unpack Table has 8,000 or more array fields.
table.sort invalid order function for sorting One of the following:
- The sort function returned true too many times.
- Order function did not return a boolean or nil while sorting.
table modified during sorting Array size changed while sorting.
getfenv no function environment for tail call at level <stack_level>
cannot change environment of given object Function is a C closure.
buffer.readstring string length overflow The string’s length exceeds the bounds of the allocated space of the buffer.
buffer.readbits bit count is out of range of [0; 32] Bit count argument is lower than 0 or higher than 32.
math.random wrong number of arguments Called with 3 or more arguments.
string.format too many captures String has more than 32 captures.
9 Likes

Are you sure this error still exists? It appears in the Luau source, but tail calls were removed when the Luau VM was released back in 2019 and from what I can tell it’s just dead code that does nothing.

Also, you forgot setfenv in the column below getfenv.

Bet you’ve never seen this before
Screenshot 2025-04-06 194831

3 Likes

I appreciate the work but quite a few of these errors are pretty self-explanatory. You should only include the lesser obvious ones for this to be more of a useful resource IMO. Sure, it says “not well-known” but the end result should:

And honestly, the more obvious stuff just serves to clutter it.

As an example, this line just rephrases what the error already states.

As an alternative, you could probably move some of the more simple/complicated errors to separate dropdowns so it’s easier to find errors people may be struggling with.

Errors such as “attempt to index out of bounds” (for doing :GetText() or any text getter operation with ScriptDocuments), “Variant cast failed” and “invalid unordered_map<K, T> key” (for ScriptDocument:MultiEditTextAsync()), “attempt to cast array to token” when you try passing an array as an Enum param, and more should be included here… just really vague errors nobody would know what would mean

Heres an example description for “attempt to index out of bounds”, in the case of ScriptDocument:GetLine()

“User attempted to get a line whos index is more than the total line count of the script document.”

Or in the case of ScriptDocument:EditTextAsync():

“User attempted to write to a line that is more than ScriptDocument:GetLineCount() + 1, and/or attempted to write to a line with a startCharacter of less than 1.”

Honestly I’d cover more errors like this which are completely the same for multiple functions, because that makes them even more vague and thus more worthy to explain.

2 Likes