Troubleshooting Common FiveM Server Errors
Diagnose and fix the most common FiveM server errors including license failures, resource crashes, and database connection issues.
Overview
Most FiveM server problems fall into a handful of categories: startup failures, resource errors, database connectivity, and player connectivity. This guide covers the most common errors with specific diagnostic steps and fixes.
Where to Find Logs
| Location | What it contains |
|---|---|
| txAdmin live console | Real-time FXServer output; most errors appear here first |
resources/[system]/[monitor]/monitor.log |
Persistent txAdmin log; survives restarts |
| Database error log | MySQL/MariaDB errors (usually /var/log/mysql/error.log on Linux) |
| Panel console | Container-level output; useful for startup failures before FXServer initializes |
Always start by reading the txAdmin console. Most errors print a clear message with the resource name or file that failed.
License Key Errors
Error: License key not found or server exits immediately after startup.
Cause: sv_licenseKey is missing, incorrect, or the key was revoked.
Fix:
- Verify the key in
server.cfgmatches exactly what is shown athttps://keymaster.fivem.net. - Confirm the server's public IP matches the IP registered for the key in Keymaster.
- If the key was regenerated, update
server.cfg(or the panel'sSERVER_LICENSE_KEYvariable) with the new key. - Restart FXServer.
Resource Failed to Start
Error: [ResourceName] Resource failed to start or Error parsing script.
Cause: Syntax error in fxmanifest.lua or a Lua/JS/C# script file.
Fix:
- Look at the line immediately following the error in the txAdmin console — Lua errors print the filename and line number.
- Open the file and inspect the reported line for mismatched brackets, missing commas, or invalid strings.
- Common Lua pitfalls: using
==for assignment instead of=, missingendforif/forblocks, unclosed string literals. - Run
start ResourceNamein the txAdmin console to re-attempt starting the resource after fixing the file.
MySQL Connection Failed
Error: [oxmysql] Failed to connect to database or MySQL connection failed.
Cause: Incorrect connection string, MySQL not running, or missing user permissions.
Fix:
set mysql_connection_string "mysql://user:password@localhost/database?charset=utf8mb4"
Check each component:
- Verify MySQL/MariaDB is running:
sudo systemctl status mariadb - Test the credentials manually:
mysql -u user -p database - Confirm the user has
GRANT ALLon the database - If the password contains special characters (
@,/,#), URL-encode them in the connection string - On panel-hosted servers, use
127.0.0.1instead oflocalhostif the connection is refused
Players Cannot Connect
Symptoms: Server appears in txAdmin as running but players get "Connection timed out" or "Couldn't connect to server".
Checklist:
- Confirm port
30120is open for both TCP and UDP in the firewall - Verify
endpoint_add_tcpandendpoint_add_udpare both present inserver.cfg - Confirm the server is reachable:
nc -zv SERVER_IP 30120 - Check that
sv_licenseKeyis valid — an invalid key can prevent cfx.re routing - In the panel, verify port
30120is allocated to this server instance
OneSync-Related Script Errors
Error: attempt to call nil value on natives like GetAllVehicles after enabling OneSync.
Cause: Certain natives do not work as expected with OneSync's entity scope system.
Fix: Replace entity-enumeration natives with server-side tracking or use GetGamePool alternatives. Consult the resource author or community forums for OneSync-compatible versions of old scripts. As a temporary measure, onesync legacy may restore compatibility at the cost of performance.
Resource Dependency Order Errors
Error: attempt to index a nil value (global 'ESX') or QBCore is nil.
Cause: A dependent resource started before the framework finished initializing.
Fix: In server.cfg, ensure the framework resource appears before all resources that depend on it:
ensure oxmysql
ensure es_extended
# ESX-dependent resources below this line
ensure esx_vehicleshop
If the order is already correct, the dependent resource may not be waiting for the framework's ready event. Check the resource's README for initialization patterns.
Server Crashes or Restarts Unexpectedly
- Check the txAdmin Diagnostics page for crash dumps.
- Look for
FATALlines in the monitor log. - Run
resmonin the server console to check for resources with high CPU or memory usage — a single poorly-written resource polling every tick can destabilize the server. - Disable recently added resources one at a time to isolate the cause.
txAdmin PIN Expired
Symptom: txAdmin shows a PIN screen but the PIN in the console is old or missing.
Fix: Restart FXServer. A new PIN is printed to the console each time FXServer starts before txAdmin setup is complete.