Hi. I keep getting the following error when I start my server.

c-scripting-core] Creating script environments for ox_lib
[ script:ox_lib] Error loading script @ox_lib/init.lua in resource ox_lib: ox_lib must be started before this resource.
[ script:ox_lib] stack traceback:
[ script:ox_lib] [C]: in function ‘error’
[ script:ox_lib] @ox_lib/init.lua:14: in main chunk
[ c-scripting-core] Failed to load script @ox_lib/init.lua.
[ resources] Started resource ox_lib

What I don’t understand is, why is it asking me to start ox_lib before ox_lib? That’s what it’s fundamentally saying. That I should’ve started ox_lib before ox_lib. This is the line of code in the init.lua:

if GetResourceState(ox_lib) ~= ‘started’ then
error(‘^1ox_lib must be started before this resource.^0’, 0)
end

How does this conceptually make sense? It’s literally saying, if ox_lib has started, then tell the user that ox_lib must be started beforehand. I don’t get what’s going on. Since this is a dependency for ox_inventory, that doesn’t work for me either. Can someone please help me fix/understand this? Thank you so much.

BTW:

The order of the start resources in my server.cfg is correct.

1 Like

You’ve modified fxmanifest.lua for ox_lib, for some reason, and have told it to load ox_lib/init.lua.

As that specific file is not meant to be loaded inside ox_lib at all, but rather in other resources, it is naturally resulting in an error.

2 Likes

I can’t thank you enough. This caused my ox_inventory and ox_fuel to finally start working. You’re a miracle worker

1 Like

i also keep getting this error

ox_lib should be started before this resource.

[ script:plush-tuning] Error loading script server/server.lua in resource plush-tuning: @plush-tuning/server/server.lua:1: No such export getSharedObject in resource es_extended
[ script:plush-tuning] stack traceback:
[ script:plush-tuning] [C]: in function ‘error’
[ script:plush-tuning] citizen:/scripting/lua/scheduler.lua:878: in metamethod ‘index’
[ script:plush-tuning] @plush-tuning/server/server.lua:1: in main chunk
[ c-scripting-core] Failed to load script server/server.lua.
[ citizen-server-impl] Started resource plush-tuning
[ citizen-server-impl] Couldn’t find resource plush-vehicleshop.
[ c-scripting-core] Creating script environments for plush-boat
[ script:plush-boat] Error loading script @ox_lib/init.lua in resource plush-boat: ox_lib should be started before this resource.
[ script:plush-boat] stack traceback:
[ script:plush-boat] [C]: in function ‘error’
[ script:plush-boat] @ox_lib/init.lua:14: in main chunk
[ c-scripting-core] Failed to load script @ox_lib/init.lua.

Yes, that’s because ox_lib should be started before that resource. Not sure what else you want me to say?

hint #1: fxmanifest
hint #2: dependency
hint #3: use your brain

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.