How to fix common FiveM console errors: a practical debug guide

Learn how to identify and fix the most frequent FiveM console errors: script error, missing dependency, invalid fxmanifest and database failures.

The FiveM console is the starting point for any serious debug session. It accumulates error messages in real time — some critical, some silent — and ignoring those lines is the fastest path to an unstable server. Experienced owners read the console every time they bring up a new resource; beginners only look when a player complains on Discord.

This guide covers the most common errors that show up in the console of a production FiveM server: script errors, missing dependencies, invalid manifests, database failures and framework problems. For each error we show how to identify the real cause and apply a definitive fix — not just silence the message.

Estimated reading and execution time: 25 to 40 minutes, depending on how many resources you need to audit.

Prerequisites

Before starting the debug session you need access to the server and the ability to restart resources individually.

Prerequisites

Access to the RCON console or txAdmin, admin permission on the server, txData/ or resources/ folder accessible via SFTP, and the ability to restart the entire server if needed. Basic Lua knowledge and the ability to read stack traces help.

Server console txAdmin or RCON
Client console F8 in-game
Filesystem logs txData/logs/
Profiler profiler record N

How to read a console error message

Every FiveM error line follows a predictable pattern. Learning to decode these messages saves hours of trial and error.

The general structure is: color prefix (^1 red, ^3 yellow), error type, affected resource, file and line, description. A real example:

[       script:my_script] SCRIPT ERROR: @my_script/server/main.lua:42: attempt to index a nil value (local 'player')
> CreatePlayer (@my_script/server/main.lua:42)
> handler (@my_script/server/events.lua:18)

The first line tells you the resource (my_script), the file (server/main.lua), the line (42) and the type (attempt to index a nil value). The lines starting with > are the stack trace — read top-down to follow the chain of calls that led to the error.

Inverted stack traces

FiveM lists the most recent frame first (the opposite of what Python or Node do). The line that fired the error is the first >, the function that called it comes next, and so on until the root event.

Error 1: SCRIPT ERROR — attempt to index a nil value

The most common error on FiveM servers, especially after framework updates or custom script changes.

01

Identify the nil variable in the error. The message attempt to index a nil value (local 'player') means player was not defined before being used.

Open the file at the indicated line and read the context immediately above:

RegisterServerEvent('myresource:save')
AddEventHandler('myresource:save', function(data)
    local player = ESX.GetPlayerFromId(source)
    player.setMoney(data.amount)
end)

If ESX.GetPlayerFromId(source) returns nil (player disconnected mid-event, or ESX hasn’t initialized), the next line breaks.

02

Add a guard clause before any indexing:

RegisterServerEvent('myresource:save')
AddEventHandler('myresource:save', function(data)
    local player = ESX.GetPlayerFromId(source)
    if not player then
        print(('[myresource] Player %s not found, event ignored'):format(source))
        return
    end
    player.setMoney(data.amount)
end)

This fail-fast pattern with a named log replaces the crash with an informative console line — without losing the context of the problem.

03

Restart the resource and trigger the event manually to confirm the error was suppressed without masking the root cause:

restart myresource
Don't silence without investigating

Adding guard clauses without understanding why the variable came back nil masks timing bugs. Always log the silenced case to detect patterns (e.g. player disconnected, event arrived before the framework loaded, invalid source coming from the client).

Error 2: Could not find dependency X for resource Y

This appears when a resource’s fxmanifest.lua declares a dependency on another resource that isn’t started or doesn’t exist on the server.

01

Read the full message. Example:

Could not find dependency oxmysql for resource es_extended.
Couldn't start resource es_extended.

It means es_extended declares dependency 'oxmysql' in its manifest but the server couldn’t start oxmysql first — either because it’s missing or because the order in server.cfg is wrong.

02

Check that the dependency resource exists in the resources/ folder:

ls resources/ | grep oxmysql

If it returns nothing, download it from the official repository (overextended/oxmysql on GitHub) and place it in resources/[standalone]/oxmysql.

03

Ensure the correct order in server.cfg. Dependencies need to be started before anything that depends on them:

ensure oxmysql
ensure es_extended
ensure esx_menu_default
ensure my_scripts

Order matters: ensure processes line by line. Put frameworks and libraries (oxmysql, es_extended, qb-core, ox_lib) at the top, then dependent scripts.

Error 3: Couldn’t load resource manifest

The server found the resource folder but failed to parse fxmanifest.lua. Typically a syntax error or invalid version.

01

Open the affected resource’s fxmanifest.lua and confirm the minimum header:

fx_version 'cerulean'
game 'gta5'

author 'your_name'
description 'resource description'
version '1.0.0'

server_scripts {
    'server/*.lua'
}

client_scripts {
    'client/*.lua'
}

The fx_version and game fields are mandatory. fx_version accepts fixed values: 'cerulean' (most recent), 'bodacious', 'adamant'. Use 'cerulean' on any modern server.

02

If you still have resources with __resource.lua, migrate them. The legacy format doesn’t support modern features and triggers a deprecation warning. Rename the file and adjust the syntax — the biggest difference is that fxmanifest.lua requires fx_version and game to be declared.

Automatic validation

Resources downloaded from unknown sources may have an invisible UTF-8 BOM at the start of the file that breaks the parser. Open it in an editor that shows the encoding (VSCode shows it in the bottom right) and save as UTF-8 without BOM.

Error 4: Database connection failed (oxmysql)

Database errors show up as [oxmysql] [ERROR] Connection refused or Access denied for user. Each subtype has a distinct cause.

Connection refused

MySQL isn’t accepting connections on the configured host/port.

# Confirm MySQL is running
systemctl status mysql

# Test connectivity manually
mysql -h 127.0.0.1 -u fivem -p fivem_db

If MySQL runs in a separate Docker container, the host in the connection string must be the container name, not localhost.

Access denied

Wrong credentials in server.cfg:

set mysql_connection_string "mysql://fivem:[email protected]:3306/fivem_db?charset=utf8mb4"

Special characters in the password (@, #, /) need to be URL-encoded. The password p@ss#1 becomes p%40ss%231. Encoding errors are a frequent cause of “Access denied” even with the correct password.

Pool timeout

[oxmysql] [ERROR] Pool is closed means connections were dropped (MySQL restart, server timeout). Restart the resource:

restart oxmysql

To prevent it, configure wait_timeout in MySQL to a value higher than your server’s query interval.

Error 5: Resource X failed to start

A generic startup failure. The real cause is in the lines immediately above the message.

01

Look for lines preceding the “failed to start” error. FiveM prints the specific error before the summary. Example:

[script:my_resource] Error loading script server/main.lua in resource my_resource: server/main.lua:1: unexpected symbol near '<'
Failed to load script server/main.lua.
[c-scripting-core] Failed to start resource my_resource

The root cause is unexpected symbol near '<' on line 1 — the file probably contains HTML or XML at the start (corrupted download, you saved an error page instead of the .lua).

02

Validate Lua syntax locally before uploading:

luac -p server/main.lua

If luac is not available, use any online Lua parser or your own editor with a Lua plugin. Syntax errors are detected immediately without restarting the entire server.

Verification

After applying fixes, confirm the console is clean by running this verification sequence.

01

Restart the entire server to ensure the state shown in the console reflects reality, with no “ghost” resources from previous runs:

restart all

Or via txAdmin, the “Restart Server” button.

02

Connect a client and monitor the console for 5 to 10 minutes with the server in normal use. Errors that only appear with a connected player (client-side events, synchronization) won’t show up on an empty server.

03

Filter the console by severity level. In server.cfg:

con_miniconChannels script:*

This isolates only script logs, hiding noise from internal subsystems during troubleshooting.

Troubleshooting

Error persists after restarting the resource

The resource may have a file cache. Stop it completely, delete the cache/ folder at the server root and bring it up again:

stop my_resource
# stop the server
rm -rf cache/
# start the server
ensure my_resource

Console fills with identical errors every second

A loop is firing the error every tick. Identify the resource from the first line of the error and stop it immediately:

stop resource_name

Investigate the code offline before bringing it back up — leaving it running in a loop can tank performance for the entire server.

Error with no stack trace

Native client errors (rendering, scaleform) often don’t carry a trace. Run profiler record 500 in the server console and open the profile at localhost:30120/profiler to see which resource was active at that moment.

Be careful deleting cache in production

Deleting the cache/ folder with players connected causes immediate disconnection and loses unsaved data. Always announce on Discord or schedule a maintenance window beforehand.

Next steps

With the console clean, consider the next levels of server hardening:

  • Configure log rotation via sv_logFile to preserve error history across restarts and make retroactive debugging easier
  • Add continuous profiler monitoring during peak hours to detect resources that degrade silently without firing any error
  • Document applied fixes in a per-resource CHANGELOG — when the problem returns six months from now, the history saves hours
  • Establish a review process for fxmanifest and dependencies before pushing any new resource to production

If you’re running a FiveM server in production, a Hostini VPS with dedicated game hosting gives you isolated resources, low latency to Brazil and console access through a pre-configured txAdmin — without competing for CPU with other servers on the same node.

Frequently asked questions

Why does the error only appear after the server has been running for several minutes?

Late errors are usually triggered by events that only fire when a player joins, leaves or runs a specific action. Reproduce it on an empty server by triggering the event manually via console or admin command to isolate the trigger.

Can I ignore errors that don't crash the server?

No. Silent errors burn CPU every tick and accumulate memory leaks. One SCRIPT ERROR per tick over 30 minutes generates tens of thousands of exceptions and degrades the performance players actually feel.

How do I find which resource is causing lag without any visible error?

Run resmon in the F8 client console or profiler record 500 in the server console. Times above 1 ms per tick indicate a problematic resource. SCRIPT ERROR often precedes degradation only detectable through the profiler.

fxmanifest.lua or __resource.lua, which one should I use?

Always fxmanifest.lua with fx_version 'cerulean' and game 'gta5'. __resource.lua is a 2018 legacy format and doesn't support modern features like export scopes, declared dependencies or file globs. Migrate any old resource.

Why do oxmysql errors disappear after restarting the database?

Zombie connections in the pool aren't reopened until MySQL's timeout kicks in (8 hours by default). Restart the oxmysql resource after any database maintenance or configure mysql_connection_string with a smaller pool_size and tune wait_timeout in MySQL.

How do I enable detailed logs without flooding the console?

Use con_miniconChannels script:* in server.cfg to filter only script logs, or route them to a file with sv_logFile. Combine with con_channelFilter to exclude verbose resources during troubleshooting.

Topics:
Next steps VPS, dedicated or managed panel for FiveM, SAMP, MTA, Tibia and more.Host your game server with Hostini →
Was this tutorial helpful?
Chat on WhatsApp