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.lua

Possible 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:

  1. Open FileZilla
  2. Go to TransferTransfer TypeBinary
  3. Re-upload the entire resource

Update server artifacts

Run version in the server console. If it's below 4752, update.

  1. Download the latest recommended artifacts from the Windows artifacts page
  2. Stop your server
  3. Remove the old server folder and replace it with the new one
  4. Start the server and run version to confirm
  1. Download the latest recommended artifact from the Linux artifacts page
  2. Stop your server
  3. Delete the cache and alpine folders
  4. Extract with tar -xf fx.tar.xz
  5. Start the server and run version to confirm

Clear the server cache

Delete the cache folder in your server directory and restart.

Fresh install

If nothing else works:

  1. Delete the resource folder entirely
  2. Download a fresh copy from the CFX Portal
  3. Upload via WinSCP
  4. Disable any anticheat that dumps or modifies Lua files
  5. Restart the server

On this page

Need help?

Ask on Discord