THE ORB
Starting the studio

attempt to yield across a C-call boundary

A script tried to wait in a place where waiting is not allowed. It is a coding mistake, not a setup one.

groupsThat feature stops workingcodeNeeds a developer

Do this first

This needs a code change in that script — the author or a developer has to move the waiting part.

bug_reportPaste your whole console instead

What it means

Code tried to wait inside a place that cannot be paused. Lua can only suspend its own frames; when the call chain currently runs through native (C++) code, there is nothing to suspend, so the wait is illegal.

What causes it

Ordered by how often it is the answer.

  1. 1

    A Wait or an await inside a table.sort comparator

    table.sort is native. Anything the comparator does must return immediately.

  2. 2

    Waiting inside a string.gsub replacement function

    Also native.

  3. 3

    Waiting inside a NUI callback

    RegisterNUICallback handlers must call cb() and return; awaiting a query inside one hits this on some builds.

  4. 4

    Waiting inside pcall on older Lua

    Lua 5.4 allows yielding through pcall, but older runtimes and some native wrappers do not.

  5. 5

    Waiting inside a state bag change handler

    Those are invoked from the native layer.

How to tell which one is yours

The traceback names the native frame. Ask a simpler question of the failing line: is it inside a function I passed to something else? If yes, that is the boundary.

Where to look

The function passed as an argument on or above the failing line.

How to fix it

Do the waiting outside, and keep the callback synchronous:

-- wrong
RegisterNUICallback('buy', function(data, cb)
    local rows = MySQL.query.await('SELECT ...')   -- boundary
    cb(rows)
end)

-- right
RegisterNUICallback('buy', function(data, cb)
    cb({ ok = true })                 -- answer immediately
    CreateThread(function()           -- then do the slow work
        local rows = MySQL.query.await('SELECT ...')
        SendNUIMessage({ action = 'result', rows = rows })
    end)
end)

Still stuck on your own code?

This page is what this error usually means. Paste your console into Server Fixer and it will rank everything in it and tell you what to do first, and if you would rather not touch it, ORBIE can repair the script and hand the resource back ready to drop in.

bug_reportOpen Server Fixer

Errors that travel with this one