Could not find dependency X for resource Y: how to fix it

FiveM says Could not find dependency ox_lib for resource Y? What dependency in fxmanifest.lua means, how to install the missing resource, folder naming and start order.

You start a script and the console says:

text
Could not find dependency ox_lib for resource my_script.
Couldn't start resource my_script.

The script is refusing to start because something it needs is not there. This article explains what the line means and how to fix the three usual causes: the resource is not installed, the folder has the wrong name, or it is in the wrong place.

What a dependency is

In fxmanifest.lua, a script can declare that it needs other resources:

lua
fx_version 'cerulean'
game 'gta5'

dependency 'ox_lib'

-- or several at once
dependencies {
    'ox_lib',
    'oxmysql',
}

When my_script starts, FiveM checks that each name exists as a resource. If one is missing, the start is cancelled, which is better than running half broken and throwing nil errors later.

The name FiveM looks for is the resource name, which is the folder name. Brackets in parent folders such as [standalone] are only categories and are not part of the name.

Step 1: find which resource is missing

The text between dependency and for resource is the name of the missing resource. In the example it is ox_lib. Look for a folder with exactly that name:

bash
# from your server's resources folder
find . -maxdepth 3 -type d -name "ox_lib"

On Windows, use the search box in File Explorer on the resources folder, or Get-ChildItem -Recurse -Directory -Filter ox_lib in PowerShell. If nothing comes back, the resource is not installed.

Step 2: install it

Download the resource from its official source, put the folder under resources, and add it to server.cfg before the script that needs it:

cfg
ensure oxmysql
ensure ox_lib
ensure my_script

Common dependencies are ox_lib and oxmysql, plus your framework (es_extended, qb-core or qbx_core). For ox_lib specifically, there is a catch with the download: see @ox_lib/init.lua not found.

After adding a folder to a running server, run refresh in the console, then ensure my_script.

Step 3: fix the folder name

The dependency exists but the error still shows. Check the exact name. These are the names people end up with by accident:

Folder on disk Needs to be
ox_lib-main ox_lib
ox_lib-master ox_lib
oxmysql-main oxmysql
qb-core-main qb-core
ox_lib (1) ox_lib

GitHub source zips add -main or -master to the folder name, and browsers add (1) to repeated downloads. Rename the folder and update server.cfg to match. On Linux, capitalisation matters too: Ox_Lib is not ox_lib.

Also check for the nested-folder mistake, where the unzipped folder contains one more folder with the same name:

text
resources/ox_lib/ox_lib/fxmanifest.lua   (wrong)
resources/ox_lib/fxmanifest.lua          (right)

Step 4: make sure the dependency can start

If the folder is right but the error persists, the dependency may exist and still fail itself. Look in the console for the dependency's own error, which will appear above the line you pasted. Typical causes are a database error for oxmysql, or an unbuilt web folder for ox_lib. Fix that first, then start the dependent script. The wider diagnosis is in Couldn't start resource.

Start order in server.cfg

Resources start in the order of the ensure lines. Put the base layers first:

cfg
ensure oxmysql
ensure ox_lib
ensure es_extended        # or qb-core / qbx_core
ensure my_script

Because my_script declares its dependencies, FiveM will start them for you if you forget. Even so, write the order out. A list that reads from base to top is easier to debug, and scripts that do not declare a dependency (many do not) only work when the order is right. The full pattern is in the right ensure order in server.cfg.

Adding a dependency to your own script

If you write scripts, declare what you use. If my_script calls exports.ox_lib or lib. functions, add:

lua
dependency 'ox_lib'

You can also require a server build or OneSync in the same list:

lua
dependencies {
    '/onesync',
    'ox_lib',
}

Declaring dependencies turns a hard to read nil error into a clear start message.

Tip: a dependency listed in the manifest that the script no longer uses will block it from starting on a server without that resource. Remove old entries when you rework a script.

Checklist

Symptom Fix
Could not find dependency ox_lib Install ox_lib under resources
Folder is ox_lib-main or ox_lib (1) Rename to the exact resource name
Folder nested twice Move the inner folder up so fxmanifest.lua is directly inside
Added folder, server still unaware Run refresh in the console
Dependency exists but fails Read its own error above the line and fix it first
Order unclear oxmysql, ox_lib, framework, then scripts

Quick answers

What does Could not find dependency mean?

The resource's fxmanifest.lua lists another resource under dependency or dependencies, and FiveM cannot find a resource with that exact name on your server.

Is the dependency's folder name important?

Yes. FiveM matches the folder name, not the project name. A folder called ox_lib-main is not ox_lib, so it must be renamed.

Do I have to ensure the dependency before the script?

It is good practice and it keeps things predictable. FiveM also starts a listed dependency for you when the dependent resource starts, as long as the folder exists.

Scripts that skip this problem

Mic PhoneA foldable phone that unfolds into a tablet and carries onto a player's real phone.View script →CCTV Security CamerasPlaceable cameras, a live multi-view tablet and printed evidence photos.View script →Item Creator V2Create usable items with animations, props, effects and more — without writing code.View script →

Keep reading