Syntax Error / Error Parsing
Fixing 'syntax error near <\1>' and 'Error parsing script' errors in FiveM.
Error Messages
You may see one of these in your server console:
syntax error near '<\1>'Error parsing script @your_resource/server/file.lua in resource your_resource:
@your_resource/server/file.lua:1: syntax error near '<\1>'Failed to load script @your_resource/server/file.luaPossible Causes
Solutions
Re-upload with WinSCP
Download the script again from the CFX Portal and upload using WinSCP instead of FileZilla.
Always upload the .zip file to your server first, then extract it there. Never transfer the folder file-by-file.
Or: switch FileZilla to Binary mode
If you must use FileZilla:
- Open FileZilla
- Go to Transfer → Transfer Type → Binary
- Re-upload the entire resource
Update server artifacts
Run version in the server console. If it's below 4752, update.
- Download the latest recommended artifacts from the Windows artifacts page
- Stop your server
- Remove the old server folder and replace it with the new one
- Start the server and run
versionto confirm
- Download the latest recommended artifact from the Linux artifacts page
- Stop your server
- Delete the
cacheandalpinefolders - Extract with
tar -xf fx.tar.xz - Start the server and run
versionto confirm
Clear the server cache
Delete the cache folder in your server directory and restart.
Fresh install
If nothing else works:
- Delete the resource folder entirely
- Download a fresh copy from the CFX Portal
- Upload via WinSCP
- Disable any anticheat that dumps or modifies Lua files
- Restart the server
