FiveM Docs
Getting Started

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:

  1. Server console or txAdmin Live Console: server-side errors, resource start failures, database errors.
  2. F8 console in game: client-side script errors.
  3. 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:

  1. Missing import. Add it to the resource's fxmanifest.lua, above your own files:
    fxmanifest.lua
    shared_scripts {
        '@es_extended/imports.lua',
        'config.lua',
    }
  2. Wrong start order. The resource starts before es_extended. Move its ensure line below the ESX lines in server.cfg and add dependency 'es_extended' to its manifest.
  3. 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.
  4. 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_lib exists. It is new in recent releases; servers updated by copying only es_extended often miss it.
  • oxmysql exists and comes from the release zip, not the GitHub source code.
  • There is exactly one es_extended folder and its fxmanifest.lua sits directly inside it (not es_extended/es_extended/fxmanifest.lua or es_extended-main).
  • Your server build is current. Old builds miss natives that es_extended requires.

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:

ErrorMeaningFix
ECONNREFUSEDNothing listens on that host and port.Start MariaDB (Windows: Services, MariaDB). Check host and port 3306.
ER_ACCESS_DENIED_ERRORWrong user or password.Test the same credentials in HeidiSQL. Check for special characters in the password (URL-encode them).
ER_BAD_DB_ERROR / Unknown databaseThe database name does not exist.Create it, or fix the name in the connection string.
ER_NO_SUCH_TABLE / Table '...users' doesn't existConnected, 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:

  1. 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.
  2. Database errors. If the users query fails, the player never loads. See the oxmysql section above.
  3. Missing [core] resources. Without esx_multicharacter or esx_identity, character creation cannot finish. Check that ensure [core] is in server.cfg and all core resources started.
  4. 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).
  5. Game build mismatch. A resource that streams assets for a newer game build than sv_enforceGameBuild can 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 from server.cfg, so ESX cannot grant permissions.
  • You are typing an ox_inventory command name on a server with the default inventory or vice versa: /giveitem and /giveweapon from 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.

Frequently asked questions

Independent documentation

esx-fivem.com is a community project and is not affiliated with the ESX Framework team. Facts on this page were checked against the upstream source. Official resources: docs.esx-framework.org and github.com/esx-framework.
Edit on GitHub

Last updated on

On this page