Troubleshooting
Common issues and solutions for ESX framework.
This guide covers common issues encountered when working with ESX framework and their solutions.
Installation Issues
Database Connection Problems
Error: "Access denied for user"
Symptoms:
Solutions:
- Check Database Credentials:
 
- Verify Connection String:
 
- Check MySQL Service:
 
Error: "Database 'esx_server' doesn't exist"
Solution:
Resource Loading Issues
Error: "Resource [es_extended] couldn't be started"
Symptoms:
Solutions:
- Check Resource Path:
 
- Verify fxmanifest.lua:
 
- Check Dependencies:
 
Error: "ESX object is nil"
Symptoms:
- Scripts can't access ESX functions
 - Error: "attempt to index a nil value (global 'ESX')"
 
Solutions:
- Proper ESX Initialization:
 
- Wait for ESX to Load:
 
Database Schema Issues
Error: "Table doesn't exist"
Symptoms:
- MySQL errors about missing tables
 - Resources fail to start
 
Solutions:
- Import Missing Tables:
 
- Check Required Tables:
 
Player Data Issues
Player Data Not Loading
Error: "Player data is nil"
Symptoms:
- Player spawns but has no data
 - Commands don't work
 - Money/job shows as nil
 
Solutions:
- Check Player Loading Events:
 
- Verify Database Schema:
 
- Check for Database Corruption:
 
Error: "Player already exists"
Symptoms:
- Cannot create new character
 - Gets stuck on character creation
 
Solutions:
- Check for Duplicate Identifiers:
 
- Clear Character Data:
 
Money/Account Issues
Error: "Money is not updating"
Solutions:
- Check Account Format:
 
- Check Money Functions:
 
Error: "Account type doesn't exist"
Solutions:
- Check Account Configuration:
 
- Add Missing Account Types:
 
Job Issues
Error: "Job doesn't exist"
Solutions:
- Verify Job in Database:
 
- Check Job Assignment:
 
Inventory Issues
Inventory Not Working
Error: "Items not showing"
Solutions:
- Check Inventory Table:
 
- Verify Item Registration:
 
- Check Weight System:
 
Error: "Cannot add item"
Solutions:
- Check Item Limits:
 
- Check Item Configuration:
 
Vehicle Issues
Error: "Vehicles not spawning"
Solutions:
- Check Vehicle Database:
 
- Check Vehicle Model:
 
- Check Vehicle Ownership:
 
Society/Job Issues
Society Not Working
Error: "Society account not found"
Solutions:
- Check Society Tables:
 
- Create Missing Society:
 
- Check Society Access:
 
Menu System Issues
Menus Not Working
Error: "Menu doesn't open"
Solutions:
- Check Menu Resources:
 
- Check Menu Dependencies:
 
- Test Basic Menu:
 
Notification Issues
Error: "Notifications not showing"
Solutions:
- Check Notification Resource:
 
- Test Notifications:
 
Performance Issues
High Resource Usage
Server Performance Problems
Symptoms:
- High CPU usage
 - Lag/stuttering
 - Thread hitches
 
Solutions:
- Identify Resource Usage:
 
- Optimize Database Queries:
 
- Reduce Timer Frequency:
 
Memory Leaks
Increasing Memory Usage
Solutions:
- Check for Event Listeners:
 
- Clear Player References:
 
Debug Techniques
Logging and Debugging
Enable Debug Mode
Database Debugging
Console Commands for Debugging
Common Error Messages
Script Errors
| Error | Cause | Solution | 
|---|---|---|
attempt to index a nil value (global 'ESX') | ESX not initialized | Proper ESX initialization | 
attempt to call a nil value (method 'getMoney') | xPlayer is nil | Check if player exists | 
bad argument #1 to 'pairs' | Trying to iterate nil value | Check if table exists | 
attempt to index a nil value (field 'job') | Player data not loaded | Wait for esx:playerLoaded | 
Database Errors
| Error | Cause | Solution | 
|---|---|---|
Table 'esx_server.users' doesn't exist | Missing database tables | Import SQL files | 
Column 'accounts' cannot be null | Invalid data insertion | Provide default values | 
Duplicate entry | Trying to insert duplicate key | Use proper constraints | 
Data too long for column | Value exceeds column length | Increase column size | 
Prevention Best Practices
Code Quality
- Always Check for Nil:
 
- Use Error Handling:
 
- Validate Inputs:
 
Testing
- Test with Multiple Players
 - Test Resource Restart
 - Test Database Disconnection
 - Test Invalid Inputs
 - Monitor Resource Usage
 
Monitoring
- Regular Database Backups
 - Monitor Server Performance
 - Check Error Logs
 - Update Dependencies
 
Regular maintenance and monitoring can prevent most issues before they become problems.
Always test changes on a development server before applying to production.