Fix 'getSharedObject Event No Longer Exists' and ESX is nil
Fix the ESX getSharedObject event no longer exists error and ESX is nil: which es_extended versions cause it, and how to update ESX or convert the script.

- Applies to
- FiveM Legacy and FiveM for GTAV Enhanced; ESX Legacy (es_extended) releases 1.8.5 (2022-09-16) through 1.16.4 (2026-10-18), read from the esx_core repository on 2026-11-20
- Last verified
On this page
- Direct Answer
- What “Used the getSharedObject Event, this event no longer exists!” means
- Which ESX versions print “this event no longer exists”
- Why ESX is nil: “attempt to index a nil value (global ‘ESX’)”
- How to fix the esx:getSharedObject error
- What @es_extended/imports.lua does
- Start es_extended before every ESX script
- Troubleshooting
- Next Steps
Direct Answer
Used the getSharedObject Event, this event no longer exists! comes from es_extended 1.9.1 to 1.11.4. Those ESX Legacy releases do not answer the old esx:getSharedObject event, so a script that still triggers it never receives the framework object. ESX stays nil and the script fails with attempt to index a nil value (global 'ESX'). There are two fixes. Update the whole ESX [core] folder to release 1.12.1 or newer (the newest is 1.16.4, as of November 20, 2026), which answers the event again. Or edit the script: add shared_script '@es_extended/imports.lua' to its fxmanifest.lua, delete its ESX = nil and TriggerEvent('esx:getSharedObject', ...) lines, and start it after es_extended.
What “Used the getSharedObject Event, this event no longer exists!” means
Every ESX script needs the framework’s shared object: a Lua table named ESX that the es_extended resource creates. The manifest of es_extended describes it as “The Core resource that provides the functionalities for all other resources.”
Older scripts ask for that table with an event. A Cfx.re forum reply from February 2023, written to explain what to remove, quotes the two usual forms. The short one:
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
And the looping one, which keeps asking until it gets an answer:
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
Both set ESX to nil, trigger esx:getSharedObject, and wait for es_extended to call the function back with the object. On September 18, 2022, ESX announced on the Cfx.re forum that it was “Deprecating the ancient method of grabbing the ESX Object”. Later releases replaced the handler with one that only complains. This is the server-side handler in es_extended 1.10.9:
AddEventHandler("esx:getSharedObject", function()
local Invoke = GetInvokingResource()
print(("[^1ERROR^7] Resource ^5%s^7 Used the ^5getSharedObject^7 Event, this event ^1no longer exists!^7 Visit https://documentation.esx-framework.org/tutorials/tutorials-esx/sharedevent for how to fix!"):format(Invoke))
end)
client/common.lua in the same release holds an identical handler, so a client script that triggers the event produces the same message in the client console.
Three details in that code explain what you see:
- It never calls back. The handler takes no callback argument, so nothing is stored in the calling script’s
ESX. - The name after “Resource” is the script to fix. The
%sis filled fromGetInvokingResource(). ESX’s 2022 notice writes the same value asresource_namewhen it quotes the earlier warning. - The caret codes are not printed. FiveM’s console code treats a caret followed by a digit as a colour code and skips it. On screen the line reads:
[ERROR] Resource <resource name> Used the getSharedObject Event, this event no longer exists! Visit https://documentation.esx-framework.org/tutorials/tutorials-esx/sharedevent for how to fix!
With the looping form, ESX never stops being nil, so the script triggers the event again and again and the line repeats. A forum post from August 2023 describes scripts “spaming” it.
The link in the message no longer leads to a tutorial. On November 20, 2026 it redirects to the introduction page of the ESX documentation, and the current ESX docs have no page on the event. The steps below replace it.
Which ESX versions print “this event no longer exists”
The answer of es_extended to esx:getSharedObject changed several times. This table is read from the handler code at each release tag of the esx_core repository:
| es_extended release | Published | What the event does | What the console shows |
|---|---|---|---|
| 1.8.5 and older | September 16, 2022 (1.8.5) | Calls back with ESX | Nothing |
| Repository code between 1.8.5 and 1.9.0, never a tagged release | From September 18, 2022 | Calls back with ESX | [WARNING] saying the method “is deprecated and should not be used!” |
| 1.9.0 | December 29, 2022 | No handler exists | Nothing, and ESX stays nil |
| 1.9.1 to 1.10.9 | January 29, 2023 to October 14, 2024 | Prints, never calls back | [ERROR] with “this event no longer exists!” |
| 1.11.0 to 1.11.4 | November 9 to November 30, 2024 | Raises the same wording with Lua’s error(), never calls back | A script error from es_extended with the same wording, without the [ERROR] tag |
| 1.12.1 to 1.12.4 | January 2 to January 23, 2025 | Calls back with ESX again | [WARNING] saying “This is not the recommended way to import ESX.” |
| 1.13.0 to 1.16.4 | July 26, 2025 to October 18, 2026 | Calls back with ESX | Nothing |
The warning added in September 2022 was extended on October 24, 2022 to say the event would “be fully removed” on November 30, 2022. The removal was committed on December 27, 2022. A commit titled “restore backwards compat” brought the callback back on December 6, 2024, and a commit of February 7, 2025 deleted the warning that came with it.
This is the handler in release 1.16.4, in es_extended/shared/main.lua, next to the export that replaced the event:
exports("getSharedObject", function()
return ESX
end)
AddEventHandler("esx:getSharedObject", function(cb)
if ESX.IsFunctionReference(cb) then
cb(ESX)
end
end)
How to check which es_extended you run
In a recipe install the core sits in resources/[core]/es_extended. The repository kept it in a folder named [esx] up to release 1.9.0, so look there on an older server. Open es_extended/fxmanifest.lua and read the version line, but do not rely on it alone. The manifest can lag the release: release 1.16.4 still reads version '1.16.3', and release 1.13.0 reads version '13.13.0'. The current ESX recipe also downloads the repository’s main branch, not a tagged release, so a recipe install can hold code from between two releases.
The handler itself is the reliable test. Search every file in the es_extended folder for esx:getSharedObject. Releases 1.11.0 and newer keep the handler in shared/main.lua. Releases 1.10.9 and older keep it in server/common.lua and client/common.lua.
cb(ESX)in the handler: your core answers the event.- “no longer exists” in the handler: your core is in the 1.9.1 to 1.11.4 range.
- No match at all: your core has the
getSharedObjectexport but no event handler, as in release 1.9.0.
Why ESX is nil: “attempt to index a nil value (global ‘ESX’)”
The “no longer exists” line is one route to an empty ESX. The Lua error is the symptom they all share. FiveM’s Lua runtime builds it from the pattern attempt to %s a %s value%s. Here the script indexed a nil value, for example by reading ESX.GetPlayerFromId while ESX held nothing. The bracket names the variable and its kind:
(global 'ESX'): the script reads a global namedESXand nothing has stored the object in it.(upvalue 'ESX')or(local 'ESX'): the file declareslocal ESXand that local was still nil. A July 2022 forum post shows the code behind the upvalue variant:local ESX = nil, followed by the event.
A forum post from March 2024 shows how the line looks in the console:
SCRIPT ERROR: @crime/server.lua:41: attempt to index a nil value (global 'ESX')
FiveM names each script chunk @resource/file, so this error is in the resource crime, file server.lua, line 41. Errors from server files appear in the server console. Errors from client files appear in the client console, which opens with F8.
| What the console shows | Cause | Fix |
|---|---|---|
| “this event no longer exists!”, then nil errors | The script uses the event on es_extended 1.9.1 to 1.11.4 | Update ESX, or convert the script |
Nil errors only, and the script contains TriggerEvent('esx:getSharedObject' | es_extended 1.9.0, which has no handler, or the script ran before es_extended started | Update ESX or convert the script, and fix the start order |
| Nil errors only, and the script has no import at all | Nothing ever fetches the object | Add the import or the export line |
No such export getSharedObject in resource es_extended | es_extended was not running when the script started | Fix the start order or the core itself |
Failed to load script @es_extended/imports.lua. | FXServer could not read the file, or the file stopped with the error printed above this line | Check the core folder’s name and location, then the start order |
Could not find dependency esx_lib for resource es_extended. | A core from release 1.16.0 or newer was installed without esx_lib | Install the whole [core] folder |
The 1.9.0 case has no ESX message at all. A forum post from January 2023 describes it: “ESX = nil is at the top of the file. Using ESX Legacy 1.9.0”, with every ESX.RegisterServerCallback in the file failing on a nil ESX.
How to fix the esx:getSharedObject error
These steps are the same on FiveM Legacy and FiveM for GTAV Enhanced. txAdmin’s recipe lists for Legacy and for Enhanced servers point at the same ESX Legacy recipe, which installs the same [core] folder. One difference: Cfx.re lists Asset Escrow as “Not implemented yet” on Enhanced, so the escrowed-script case under Troubleshooting concerns Legacy servers.
Choose by what you can change. Option 1 needs no script edits, but it replaces the whole framework core. Options 2 and 3 change one script at a time, which is the smaller step when the script’s files are open. They work on every ESX Legacy version, because the export and imports.lua are already present in the oldest tag of the repository, 1.3.0-final.
Option 1: update ESX so the event is answered again
The ESX troubleshooting page gives one instruction for “Error ESX = nil”: “update your es_extended to the latest version.” The table above shows why that works: from release 1.12.1 the core calls old scripts back again.
- Check your version with the handler test above.
- Back up the
[core]folder and your database, and rehearse the update on a copy of the server. ESX publishes no upgrade procedure, and a jump from 1.9 or 1.10 to 1.16 changes far more than this event. The notes for release 1.10.8 (October 10, 2024) announce under “BREAKING CHANGES” that the synchronization of metadata andxPlayer.setthrough state bags was removed, and release 1.16.0 introduced a new NUI inventory. Read the notes on the esx_core releases page for every version you skip, because an old script can fail on such changes even when the event works again. - Replace the whole
[core]folder, not onlyes_extended, with the[core]folder of the release you chose. The ESX recipe installs the repository’s[core]folder asresources/[core]. Since release 1.14.0 (July 17, 2026),es_extendedloads@esx_lib/imports.lua, and since release 1.16.0 (October 11, 2026) its manifest listsesx_libnext tooxmysqlas a dependency. A currentes_extendedwithoutesx_libdoes not start. The recipe takes the addon resources in[esx_addons]from a separate repository, so this step does not update them. - Expect to lose edits made inside the core. A replaced folder no longer contains them, and the ESX docs state: “We do NOT provide any support for editing core files”.
- Start the resources in the recipe’s order (see the start order section below).
- Use a current server artifact. The
es_extendedmanifest also requires two natives. For “Native XXXXXXXX is not supported”, the ESX troubleshooting page says it may come from the “recommended version” of the artifacts and tells you to use the latest artifact. ESX’s install guide tells new servers to download “the latest recommended artifacts”, so the two pages disagree. When the native error appears, follow the troubleshooting page. See how to update FXServer artifacts. - Start the server and watch the console. Since release 1.13.4 (August 31, 2025) the core runs “auto-migrations on startup” that change the database. One of them adds a column to the
jobstable. Release 1.16.4 announces them withRunning migrations for ESX version, and when a migration asks for it, the console repeatsServer restart required!until you restart the server.
Option 2: convert the script to @es_extended/imports.lua
This is the method ESX documents for new scripts, and the one its own resources use.
-
Open the script’s manifest. It is
fxmanifest.luain the resource folder, or__resource.luain a very old resource. fxmanifest.lua explained covers every entry. -
Add the import. The official
esx_notifyresource does it with one line:shared_script '@es_extended/imports.lua' -
Declare the dependency. The ESX docs’ example manifest adds:
dependencies { 'es_extended' -- Ensure the script starts after es_extended so that the functions work. } -
Delete the old code from every file. Remove each
ESX = nilline, eachTriggerEvent('esx:getSharedObject', ...)call and any loop around it, in client and server files alike. If the thread around the loop holds other code, remove only thewhile ESX == nilloop and keep the rest. The import has already setESXby the time those files run, because FiveM loads a resource’s shared scripts before its client or server scripts. A leftoverESX = nilwipes the object again. -
Reload and test. In the server console run
refresh, thenensurefollowed by the resource name.refreshrescans the resources folder and reloads the manifests.ensurerestarts a running resource, or starts a stopped one.
Option 3: call the export in each file
If you prefer not to touch the manifest, replace the old lines in each file with the export call. This is the first statement of imports.lua itself:
ESX = exports["es_extended"]:getSharedObject()
Put it where the old lines were, in client files and in server files alike. The two sides run separately, so a line in a server file does nothing for a client file. The name in brackets is the resource the export comes from, so it must stay es_extended.
Before you install any script, including one from FiveCrate’s FiveM scripts category, check which framework it expects and how it fetches the framework object. For an ESX script that is the event, the import or the export. How to install FiveM scripts covers the rest of the installation.
What @es_extended/imports.lua does
The @ prefix tells FiveM to load a file from another resource: the text between @ and the first slash is the resource name, and the rest is the path inside it. @es_extended/imports.lua is therefore the file imports.lua in the resource named es_extended, and es_extended lists that file in its manifest.
In release 1.16.4 the file does more than fetch the object:
| Side | What imports.lua sets up |
|---|---|
| Both | ESX = exports["es_extended"]:getSharedObject() as its first statement |
| Client | Handlers for esx:playerLoaded, esx:setPlayerData and esx:onPlayerLogout that keep ESX.PlayerData and ESX.PlayerLoaded current. Unless a custom inventory is configured, also handlers that keep the inventory and loadout in ESX.PlayerData current |
| Server | The helper functions ESX.Player and ESX.ExtendedPlayers |
Both, only when ox_lib is missing | ESX.require, assigned to require |
A script that uses the bare export line from Option 3 gets the object without these extras.
Start es_extended before every ESX script
The import and the export both need a running core. FiveM turns exports["es_extended"]:getSharedObject() into an event named after the resource and the export. When nothing answers, it raises No such export getSharedObject in resource es_extended. The old event has the same weakness: es_extended registers its handler when it starts, so a script that triggers the event earlier gets no reply.
The official ESX Legacy recipe starts the core before everything that depends on it:
## Starting Default & Standalone Resources
ensure chat
ensure oxmysql
ensure esx_lib
## Starting ESX Legacy Core & Addons
ensure es_extended
ensure [core]
ensure [standalone]
ensure [esx_addons]
Keep your own ensure lines below ensure es_extended. The manifest entry dependency 'es_extended' enforces the same thing from the script’s side: the manifest reference says it “Requires the specified resource to load before the current resource”, and FXServer starts a dependency that is not yet started. If no resource with that name exists, the console prints Could not find dependency es_extended for resource followed by the script’s name, and the script does not start. ESX’s own esx_whitelist resource words the rule this way: “es_extended is not available. Ensure es_extended starts before this resource.”
Troubleshooting
The “no longer exists” error still appears after adding imports.lua
The import gives the script a working ESX. It does not remove the old call. As long as one file still runs TriggerEvent('esx:getSharedObject', ...), es_extended 1.9.1 to 1.11.4 reports it. Read the resource name in the message, then search every client and server file of that resource for getSharedObject. If the message names a different resource each time, each of them needs the same edit.
“attempt to index a nil value (global ‘ESX’)” after adding imports.lua
Check three things, in this order:
- A file still contains
ESX = nil. A reply in a Cfx.re forum thread about this error gives the same answer: “you still have ESX = nil on top of the script”. This also explains an error whose path is@es_extended/imports.lua, such as thees_extended/imports.lua:6error posted in March 2024. The import assignsESXin its first statement and its client handlers useESX.PlayerDatalater, so whenESXis nil there, look for code that ran afterwards and cleared it. - The import covers one side only.
shared_scriptloads a file on the client and on the server. An import listed underclient_scripts, as in the officialesx_menu_defaultresource, or underserver_scriptsreaches that side alone. Compare where the error appears, server console or F8, with where the import is listed. - The import itself failed. Look above the error for
Failed to load script @es_extended/imports.lua., which has its own entry below.
“attempt to index a nil value (upvalue ‘ESX’)”
The file declares local ESX = nil and fills it through the event. Convert it like any other script, and delete the local ESX line as well. Lua treats a name as global “unless explicitly declared as a local”, so a local named ESX hides the global that the import sets.
“No such export getSharedObject in resource es_extended”
The script asked for the export before the core was running, or the core never started. Scroll up in the console to the first error that mentions es_extended, and compare your server.cfg with the recipe order above. The export is looked up by resource name, so a core folder that is not named es_extended produces the same message. So does a server with no es_extended resource at all, such as a Qbox or QBCore server: a script written for ESX has nothing to import there.
“Failed to load script @es_extended/imports.lua.”
FXServer prints this line whenever the file fails, for one of two reasons:
- The file could not be read. FXServer looks for a resource named exactly
es_extended. Check that the core folder has that name and sits inside your resources directory. The ESX recipe keeps it inresources/[core]. - The file stopped with an error. The line above then begins with
Error loading script @es_extended/imports.lua in resourceand carries the real cause, for example theNo such exporterror from the previous entry.
“Could not find dependency esx_lib for resource es_extended.” after an update
Only the es_extended folder was replaced, with one from release 1.16.0 or newer. Install the complete [core] folder from the same release and add ensure esx_lib above ensure es_extended. Couldn’t start resource covers dependency errors in general.
The script is escrowed and cannot be edited
Cfx.re describes Asset Escrow as a system that protects code “by preventing others from modifying or accessing certain scripts directly”. You cannot delete the old lines from a protected file, so Option 2 and Option 3 are out unless the author left that file unprotected with escrow_ignore. Use Option 1, since a core from release 1.12.1 onward answers the event for that script. ESX’s 2022 notice also tells owners of an escrowed script to ask its author for a fix.
“[WARNING] Resource … used the getSharedObject event. This is not the recommended way to import ESX.”
Your core is between 1.12.1 and 1.12.4. The script received ESX and works. The warning goes away when you convert the script or update to release 1.13.0 or newer, where the print was removed.
An old forum fix says to paste a handler into es_extended
A 2023 forum reply suggests adding a handler that calls cb(ESX) to client/common.lua and server/common.lua inside the core. Releases since 1.12.1 ship that handler themselves, and the ESX docs offer no support for edited core files. If you can update, do that instead of patching.
“attempt to call a nil value (field ’…’)”
This is a different error. The bracket says field, not global: ESX was found, but the function the script called on it does not exist. Importing ESX again changes nothing. Compare the ESX version the script was written for with the one you run.
Next Steps
- For the status of ESX Legacy next to Qbox and QBCore, read QBCore vs Qbox vs ESX.
- For
No such exportmessages that name other resources, see No such export errors. - For the QBCore version of this problem, see attempt to index a nil value (global ‘QBCore’).
FiveM scripts from FiveCrate
Listed in the FiveCrate catalogue now.
Official documentation and repository references
- ESX Docs: Common Issues (Error ESX = nil)
- ESX Docs: Developing a Script
- Cfx.re Forum: ESX Official Notice, esx:getSharedObject Deprecation
- es_extended source: shared/main.lua (release 1.16.4)
- es_extended source: imports.lua (release 1.16.4)
- ESX: esx_core releases
- ESX Legacy txAdmin recipe: server.cfg
- Cfx.re Docs: Resource Manifest
Related guides
Fix FiveM 'Couldn't Start Resource' and Dependency Errors
Couldn't start resource in FiveM means a start check failed. Read the line above it, then fix the dependency, manifest, server build or folder name.
Fix 'No Such Export in Resource' Errors in FiveM
Fix 'No such export in resource' in FiveM: find why the export is missing, then check the resource name, start order, client or server side and version.
fxmanifest.lua Explained for FiveM Server Owners
What each fxmanifest.lua line does in a FiveM resource: fx_version, game, scripts, files, data_file, dependencies, __resource.lua, lua54 and manifest errors.
Fix: attempt to index a nil value (global 'QBCore')
Fix attempt to index a nil value (global 'QBCore') on QBCore and Qbox: replace the removed import.lua with GetCoreObject, fix start order, check the bridge.
QBCore vs ESX vs Qbox: Which FiveM Framework in 2026?
QBCore vs ESX vs Qbox in 2026, from official sources: what QBCore leaving FiveM means, how Qbox and ESX Legacy differ, and which framework fits your scripts.

