| attempt to perform arithmetic on a | Tried arithmetic (+, -, *, /) on a non-number | Validate operands are numbers before arithmetic |
| attempt to compare | Tried comparison (>, <, >=, <=) on invalid values | Validate both operands are comparable before comparison |
| attempt to concatenate a | Tried concatenating a non-string with .. | Ensure both sides are strings before concatenation |
| attempt to call a | Tried to call a value that is not a function | Ensure the value is a function before calling |
| attempt to index a | Tried to index (subscript) a non-table value | Ensure the variable is a table before indexing |
| attempt to yield across a C-call boundary | Tried to yield in a context that cannot yield | When using require, ensure the required module returns without calling yielding functions (marked with exclamation in this handbook). Also avoid using yielding functions in callbacks with C bridges. |
| invalid order function for sorting | Invalid sort comparator; comparison logic is inconsistent | Use a strict order function; it must not be simultaneously a>b and a<b for any pair |
| bad argument #1 to 'xxx' (number expected, got nil) | Argument #1 to function 'xxx' is invalid; number expected but got nil | Pass a valid argument of the expected type |
| bad argument #2 to 'xxx' (number has no integer representation) | Argument #2 cannot be represented as an integer | Pass a valid argument |
| bad argument #3 to 'xxx' | Argument #3 is invalid | Pass a valid argument |