FiveM & QBCore · Practical guide

Common FiveM Errors and How to Fix Them

Every FiveM server owner hits errors. This guide covers the most common FiveM and QBCore errors and exactly how to fix each one.

Stellar AI · Updated 8 September 2026 · 6 min read

A practical guide to common fivem errors and how to fix them, with implementation decisions, validation steps, and security considerations for a production-minded project.

Overview

Stellar AI can help generate and revise the project files for this workflow. Describe your framework, existing dependencies, and one testable feature, then bring back errors for a focused revision. You remain responsible for running the tests and managing deployment in your own development environment.

Common FiveM Errors and Root Causes

Resource fails to start or "Manifest missing" errors

Symptoms: Resource logs "starting" then "stopping", or the server console shows "Could not find fxmanifest.lua or __resource.lua". Causes are generally manifest/filename errors, bad dependency declarations, or ordering problems in server.cfg.

Fixes:

  • Ensure each resource contains a valid fxmanifest.lua or __resource.lua with correct format and a matching resource folder name.
  • Declare dependencies using dependencies { 'qb-core', 'ox_lib' } or server_export as appropriate so Cfx handles start order.
  • In server.cfg, use ensure resourceName instead of start so txAdmin will auto-restart and report missing resources.

Missing exports, mismatched function signatures, or ox_lib runtime errors

Symptoms: "attempt to call a nil value" for an exported function or error referencing ox_lib. Often caused by calling exports before a dependency finished initializing or by changed API names between library versions.

Fixes:

  • Check the dependency order and use resource dependencies in fxmanifest.
  • Confirm exported function names and parameters in the dependency's README or its fxmanifest.
  • Pin library versions in your resource repository (e.g., use a git tag) so upgrades are deliberate.

Database connection and query failures (oxmysql / mysql-async)

Symptoms: Queries return nil, server logs show connection refused, or blocking on startup. Common causes: misconfigured database credentials, wrong driver, async vs sync call confusion, or missing migrations.

Fixes:

  • Verify database host, port, user and password in the server config; test the connection from the host machine.
  • Use the driver recommended by your resource (oxmysql replaces mysql-async in many modern stacks).
  • Run schema migrations before starting resources that expect DB tables. Include migration checks in your startup script.

Client CEF, NUI or Lua errors

Symptoms: CEF windows fail to render, NUI callbacks not firing, or Lua runtime stack traces on the client. Causes: wrong HTML paths in resource, mismatched NUI messages, or race conditions.

Fixes:

  • Ensure UI files are listed under files { 'html/index.html', ... } in fxmanifest.
  • Validate NUI messages: always include an action string and validate the payload on the client and on the server (never trust the client).
  • Use resource start order and explicit event synchronization if the UI requires server state before opening.

Implementation Choices and Architecture

Design server-authoritative systems. For FiveM, enforce all game-state changes server-side. For Roblox, ensure RemoteEvents only request actions; the server must validate and apply them. Key choices:

  • Use events and exports appropriately. Exports are suitable for tightly-coupled integrations; events are better for decoupling and for allowing multiple listeners.
  • Keep physics, inventory and economy logic on the server. Clients should only send intents, not results.
  • Choose your persistence layer early (MySQL via oxmysql, or cloud databases for cross-server persistence) and standardize queries with parameterized statements to avoid injections and logic errors.

Security and Server Validation

Never trust client input. This is a fundamental rule for both FiveM and Roblox. Validate every operation that affects currency, inventory, character state, or database writes on the authoritative server. Here are minimal patterns and examples.

FiveM server-side validation example (QBCore pattern)

RegisterNetEvent('shop:buyItem', function(itemId, amount)
  local src = source
  if type(itemId) ~= 'string' or type(amount) ~= 'number' then return end
  local QBCore = exports['qb-core']:GetCoreObject()
  local player = QBCore.Functions.GetPlayer(src)
  if not player then return end
  local price = GetItemPrice(itemId) -- server-side function
  local total = price * amount
  if player.Functions.RemoveMoney('bank', total, 'purchase:'..itemId) then
    player.Functions.AddItem(itemId, amount)
    TriggerClientEvent('shop:purchaseSuccess', src, itemId, amount)
  else
    TriggerClientEvent('shop:purchaseFailed', src, 'insufficient_funds')
  end
end)

Notes: Use server-owned helper functions to compute price and stock, and never accept a client-supplied total price. Always log critical transactions and consider a rate-limiter per player for sensitive operations.

Roblox RemoteEvent and authority pattern

On Roblox, RemoteEvents/RemoteFunctions are conveniences, but server authority must be preserved. Example server-side handler that validates and uses pcall for safe operations:

local Remote = game:GetService("ReplicatedStorage"):WaitForChild("RequestAction")
Remote.OnServerEvent:Connect(function(player, actionName, params)
  if typeof(actionName) ~= "string" then return end
  -- Validate actionName and params strictly
  if actionName == "BuyItem" then
    local itemId = params and params.itemId
    local amount = params and params.amount
    if typeof(itemId) == "string" and typeof(amount) == "number" and amount > 0 then
      -- Server-side currency check & inventory update
      local success, err = pcall(function()
        -- Perform DataStore or leaderstats update here with authoritative checks
      end)
      if not success then
        warn("Purchase failed for", player.Name, err)
      end
    end
  end
end)

DataStore Failure Handling (Roblox)

DataStore APIs can fail intermittently. Use pcall around GetAsync/SetAsync and retries with exponential backoff. Never discard failures silently; mark saves as pending for later retries if necessary.

local function safeGet(datastore, key, retries)
  retries = retries or 3
  local delayTime = 0.5
  for i = 1, retries do
    local ok, result = pcall(function() return datastore:GetAsync(key) end)
    if ok then return true, result end
    wait(delayTime)
    delayTime = delayTime * 2
  end
  return false, nil
end

Testing Strategies

Test in environments that closely mirror production. For FiveM:

  • Run a local fxserver or use txAdmin's staging server to replicate production configs.
  • Use isolated databases for tests and reset schema between runs.
  • Automate smoke tests that exercise login, inventory and transactions.

For Roblox:

  • Use Roblox Studio's "Start Server" + "Start Player" features to simulate multiple-player interactions.
  • Automate unit tests on Luau logic where possible and run integration tests in a staging place.
  • Use code sync tools like Rojo and a CI/CD pipeline for deterministic publishes.

Integrate observability and error grouping early. Using external tools can accelerate debugging; for instance, you can evaluate the developer tooling available in the Stellar AI app to catch hot-path regressions during integration testing. Also maintain a technical blog or changelog for your team; a short post after each deployment helps when tracking regressions (see more on the Stellar AI blog).

Deployment and Maintenance

Best practices for a smooth production lifecycle:

  • Back up databases and key config files before major releases. Automate backups and test restores periodically.
  • Deploy with staged rollouts: bring a server offline from a low-traffic region, perform migration and smoke tests, then roll forward.
  • Use rolling restarts to reduce downtime. For FiveM, restart resources individually if possible and document ordered restarts for dependencies.
  • Log and monitor critical paths: log all financial transactions, shop purchases, and admin actions with timestamps and player identifiers.

Practical Troubleshooting Checklist

Issue Likely Cause Immediate Steps
Resource won't start Missing fxmanifest / wrong path Check fxmanifest syntax, ensure in server.cfg with ensure, check file encoding
Exports nil / function missing Dependency not started or API changed Verify dependencies in fxmanifest and pin versions
DB queries failing Credentials / driver / schema mismatch Test DB connection, run migrations, switch driver if required
Client-side NUI not updating Message format mismatch / race Validate payload, add handshake event from server
Roblox save fails DataStore API throttling or transient error Use pcall, retry with exponential backoff, log failures

Maintenance Checklist

  1. Daily: Check server logs for exceptions and failed DB queries.
  2. Weekly: Run schema validation and apply minor fixes on staging first.
  3. Before each release: Snapshot DB, backup config, run full integration tests.
  4. Monthly: Review third-party dependency versions, update and test in staging.

Testing and Validation Snippets

Use lightweight scripts to validate resource health at boot time. Example: small server-side "health check" endpoint that verifies DB, critical exports, and config keys, returning a structured JSON log to your monitoring tool. Keep it read-only and rate-limited.

Build your next system with Stellar AI

Describe one feature, get organized project files, then bring back your errors to keep improving. Start free with no card required. Test generated code in a private development environment before release.

Create your first script free →