Syntax Error / Error Parsing

Fixing 'syntax error near <\1>' and 'Error parsing script' errors in FiveM.

Error Messages

You may see one of these errors 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

  • FileZilla — FileZilla corrupts escrow-protected files during transfer. Use WinSCP instead
  • Drag-and-drop via Remote Desktop — Transferring files one-by-one through RDP also damages them. Upload the .zip file and extract it on the server
  • Outdated server artifacts — Your server must be at least version 4752 or greater
  • Corrupted download — The download itself may have been corrupted
  • Server virus — A virus on your server may be modifying script files

Solutions

1. Re-upload with WinSCP

Download the script again from FiveM Keymaster and upload it 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.

2. FileZilla Binary Mode

If you must use FileZilla, switch to binary transfer mode:

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

3. Update Server Artifacts

Check your server version by running version in the server console.

If your version is below 4752, update your artifacts:

Windows

  1. Download the latest recommended artifacts from the Windows artifacts page
  2. Turn off your server
  3. Remove the old server folder and replace it with the newly downloaded version
  4. Start the server and run version to verify

Linux

  1. Download the latest recommended artifact from the Linux artifacts page
  2. Turn off 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 verify

4. Clear Server Cache

Delete the cache folder in your server directory and restart.

5. Fresh Install

If nothing else works:

  1. Delete the resource folder entirely
  2. Download a fresh copy from FiveM Keymaster
  3. Upload via WinSCP
  4. Disable any anticheat that may dump or modify Lua files
  5. Restart the server

On this page

Need help?

Ask on Discord