NexthostingLogs

Logs / Error guide / Garry's Mod

Garry's Mod: Lua syntax error “unexpected symbol near …”

What the message means

The Lua file isn't valid code – usually a comma, a bracket or a quotation mark is missing. Garry's Mod then can't load the whole file. The line number in the error shows where Lua got confused; the actual mistake is often one line earlier.

What it looks like in the log

Loading gamemode darkrp
[ERROR] addons/darkrpmodification/lua/darkrp_customthings/jobs.lua:87: unexpected symbol near 'TEAM_MEDIC'
1. unknown - addons/darkrpmodification/lua/darkrp_customthings/jobs.lua:0

Excerpt from an example log, marked the way the analysis marks it.

Common causes

  • A missing comma between two entries of a table – the classic in DarkRP jobs (jobs.lua) and shop configurations.
  • Missing or extra closing brackets, or a missing end.
  • Quotation marks from Word or Discord (“ ”) instead of plain " ".
  • File damaged or incomplete after upload.

How to fix it

  1. Open the named file and go to the line number from the error. Look at the line before it too.
  2. Check that every entry of a table ends with a comma and every bracket is closed.
  3. Replace typographic quotation marks with plain ones.
  4. Use an editor with Lua highlighting (for example VS Code); it shows such errors in color.