ScriptsAboutBlogToolsKnowledge BaseReviewsFAQBasketDocsSupport
Luacrash

attempt to yield across a C-call boundary

Also seen as: yield across C-call boundary cannot resume dead coroutine yield yield across metamethod

What causes it

Your code tried to yield (Wait, Citizen.Wait, an awaited call, or a callback that yields) from inside a context that can't be suspended — typically inside an exported function called by another resource, inside a metamethod, or inside certain native callbacks. The Lua coroutine can't pause there.

How to fix it

Don't yield inside exports/callbacks that are invoked synchronously — move the waiting work into a separate thread.

  1. Find the export or callback in the stack trace that's trying to Wait/await.
  2. Wrap the yielding work in CreateThread(function() ... end) so it runs on its own coroutine instead of blocking the caller.
  3. If an export needs to return a value, compute it without yielding; do async work separately.
  4. Restarting the dependency then the consumer can mask it temporarily, but fix the yield to solve it properly.

Related errors

Related guides

Still stuck? We can help.

Optimized, dual-framework scripts for QBCore and ESX from Viper Development — escrow protected, delivered instantly to your Cfx portal.