Stellar AI

Errors

ox_lib 'attempt to index a nil value (global lib)' – Fix

The error

attempt to index a nil value (global 'lib')

What it means

The lib global only exists if your resource loads ox_lib's init file. If it's missing from the manifest, or ox_lib starts after your resource, lib.notify, lib.callback etc. fail.

The fix

-- fxmanifest.lua
fx_version 'cerulean'
game 'gta5'
lua54 'yes'
shared_script '@ox_lib/init.lua'
client_script 'client.lua'
-- client.lua
lib.notify({ title = 'Hello', description = 'ox_lib loaded', type = 'success' })

Add lua54 'yes' (ox_lib requires Lua 5.4) and put ensure ox_lib early in server.cfg, before resources that use it.

Related tools: FiveM script generator · Fix a FiveM Lua error · all script generators