Troubleshooting ESX Legacy
Fix common ESX Legacy errors - ESX is nil, oxmysql connection failures, es_extended not starting, OneSync kicks, players stuck on loading and multicharacter problems.
This page lists the errors ESX Legacy server owners and developers run into most often, what causes them and how to fix them. Search the page (Ctrl+F) for the exact text of your error.
How to find the real error
Before you change anything, find the first error:
- Server console or txAdmin Live Console: server-side errors, resource start failures, database errors.
- F8 console in game: client-side script errors.
- Scroll up to the first red line after the server started. One root cause (for example the database being down) produces dozens of follow-up errors in other resources.
A Lua error tells you the resource, file and line: @my_script/server/main.lua:12: attempt to index a nil value. Open that file at that line.
"attempt to index a nil value (global 'ESX')"
Also seen as ESX is nil or attempt to index a nil value (field 'PlayerData').
The resource uses ESX but never received the shared object. Causes, from most to least common:
- Missing import. Add it to the resource's
fxmanifest.lua, above your own files:fxmanifest.lua shared_scripts { '@es_extended/imports.lua', 'config.lua', } - Wrong start order. The resource starts before
es_extended. Move itsensureline below the ESX lines inserver.cfgand adddependency 'es_extended'to its manifest. - Old ESX script. It uses
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)inside a thread with a wait loop. Replace that block with the import above. See Convert old ESX scripts. - es_extended is not running at all. Check the console for why it failed to start (see below).
"No such export getSharedObject in resource es_extended"
Same root cause as above: es_extended is not started yet, failed to start, or the folder is not called exactly es_extended. Fix the start order or the start failure first.
"Couldn't load resource es_extended" / es_extended does not start
es_extended declares esx_lib and oxmysql as dependencies. If FiveM cannot find one, it refuses to start es_extended, and every ESX resource fails after it. Check:
resources/[core]/esx_libexists. It is new in recent releases; servers updated by copying onlyes_extendedoften miss it.oxmysqlexists and comes from the release zip, not the GitHub source code.- There is exactly one
es_extendedfolder and itsfxmanifest.luasits directly inside it (notes_extended/es_extended/fxmanifest.luaores_extended-main). - Your server build is current. Old builds miss natives that
es_extendedrequires.
oxmysql cannot connect to the database
Players get kicked with [ESX] OxMySQL Was Unable To Connect to your database. The server console shows the actual database error from oxmysql at startup. Typical messages:
| Error | Meaning | Fix |
|---|---|---|
ECONNREFUSED | Nothing listens on that host and port. | Start MariaDB (Windows: Services, MariaDB). Check host and port 3306. |
ER_ACCESS_DENIED_ERROR | Wrong user or password. | Test the same credentials in HeidiSQL. Check for special characters in the password (URL-encode them). |
ER_BAD_DB_ERROR / Unknown database | The database name does not exist. | Create it, or fix the name in the connection string. |
ER_NO_SUCH_TABLE / Table '...users' doesn't exist | Connected, but legacy.sql was never imported into this database. | Import [SQL]/legacy.sql into the database named in the string. |
The connection string formats are explained in server.cfg.
"ESX Requires Onesync Infinity to work"
The server runs with OneSync off or legacy. Set set onesync on in server.cfg. On txAdmin, check Settings > FXServer: txAdmin's OneSync setting overrides the config file.
"ESX Requires a minimum Artifact version of 10188"
Your FiveM server build is too old. Download a current build and replace the server binaries (not your data folder).
"Native 0x... is not supported" or crashes after a build update
The server build has a known problem. Switch to the latest build, or to a known-good one listed on artifacts.jgscripts.com, which marks broken builds.
Players are stuck on the loading screen
The loading screen stays until the character loads. If it never disappears:
- Check F8 and the server console while the player is stuck. A script error during load (often in a HUD or a custom spawn script) stops the chain.
- Database errors. If the
usersquery fails, the player never loads. See the oxmysql section above. - Missing [core] resources. Without
esx_multicharacteroresx_identity, character creation cannot finish. Check thatensure [core]is inserver.cfgand all core resources started. - Conflicting spawn or loading screen resources. Two resources that both try to spawn the player or shut down the loading screen block each other. Remove duplicates (for example a second loading screen or spawn manager from another framework).
- Game build mismatch. A resource that streams assets for a newer game build than
sv_enforceGameBuildcan hang the client while loading.
Multicharacter problems
"Unable to start Multicharacter - unable to determine database from mysql_connection_string"
esx_multicharacter reads the database name from mysql_connection_string. The convar is empty or in an unexpected format. Use one of the two formats from server.cfg and make sure the database name is included.
Old characters disappear after installing multicharacter
With multicharacter, identifiers in users get a prefix per slot (by default char1:, char2: and so on, set by Config.Prefix). Characters created before multicharacter was installed do not have the prefix, so they are not listed. Back up the database, then update the old rows, for example:
UPDATE `users` SET `identifier` = CONCAT('char1:', `identifier`) WHERE `identifier` NOT LIKE 'char%:%';Other tables that store identifiers (such as owned_vehicles.owner) need the same change.
"Error code: identifier-active" or "There is already an active session for this character"
Another session with the same identifier is still registered, usually after a crash or a quick reconnect, or two people share an account. Wait for the old session to time out or restart the server. If it happens often, check for scripts that error in playerDropped and prevent cleanup.
Admin commands say "access denied"
- Your license is not in
group.admin, or your character was created before you added it. See Admin permissions. - The four
add_ace resource.es_extended ...lines are missing fromserver.cfg, so ESX cannot grant permissions. - You are typing an ox_inventory command name on a server with the default inventory or vice versa:
/giveitemand/giveweaponfrom ESX only exist without ox_inventory.
"Item "xyz" was used but does not exist!"
A script tries to give, remove or check an item that is not in the items table. Add the item (see Add items), then run /refreshitems or restart. If you use ox_inventory, items are defined in its data files instead.
"Server restart required!" repeats
ESX ran database migrations and needs one restart. Restart the server. If it shows again on every start, a migration fails before it is recorded: scroll up for Failed migration and fix that error. See Updating.
Still stuck?
- Search the esx_core issues for your exact error message.
- Ask in the official ESX Discord. Include the full error, your ESX version, server build number and what you changed last.
- Never share your license key, database password or bot tokens when asking for help.
Related
Frequently asked questions
Independent documentation
Last updated on
Updating ESX Legacy
How to update ESX Legacy safely - back up database and resources, replace the core, let migrations run, apply optional SQL hardening and test before going live.
Tools for ESX Development
Useful tools for building and running an ESX Legacy server - VS Code extensions, database clients, txAdmin and community web tools for clothing, assets and merging.