A Lua error means an addon's code tried something that didn't work. The game keeps running, but that addon's feature may break. The error tells you which file broke, and that file tells you which addon to fix, disable or report.
The Script Error Box
When an error happens, a box appears in the top left of your screen. It says one of these:
- "Something is creating script errors, check the Problems menu for details"
- "The addon "..." is creating errors, check the Problems menu for details"
When the game can tell which addon caused it, the box names it. When it can't, you get the "Something" version.
Open the Problems Menu
The Problems menu lists every Lua error since you started the game.
Open the Main Menu
Press Escape. If a server's own menu opens instead, hold Shift and press Escape to force the Garry's Mod main menu.
Click Problems
The Problems button is in the bottom right, next to the game controller icon. A number on it shows how many problems the game found.
Read the Lua Errors List
Each error shows its text, how many times it happened, and a Copy button. If the game knows the addon, you also get buttons to open it on the Workshop, disable it or uninstall it.
How to Read an Error
Here's an example error from the Garry's Mod wiki:
[ERROR] addons/my_addon/lua/autorun/server/sv_my_addon_autorun.lua:2: attempt to call global 'Print' (a nil value)
1. unknown - addons/my_addon/lua/autorun/server/sv_my_addon_autorun.lua:2| Part | Meaning |
|---|---|
addons/my_addon/... | The file that broke. The folder after addons/ is often the addon's name. |
:2 | The line in that file |
attempt to call global 'Print' (a nil value) | What went wrong |
| The numbered lines below | The stack: which code called the broken code |
You don't need to understand the message to fix it. You need the file path, so you know whose addon it is.
Common Error Messages
| Message | What it means |
|---|---|
attempt to call global '...' (a nil value) | The code called a function that doesn't exist. Often another addon it needs is missing. |
attempt to index global '...' (a nil value) | The code used something that was never set up. Often a missing or broken required addon. |
attempt to perform arithmetic on ... | The code tried to do maths on something that isn't a number. |
unexpected symbol near ... | The file has a typo, so none of it runs. |
'end' expected near '<eof>' | The file ends before its code is closed off. |
Couldn't include file '...' - File not found | A file is missing, or a server added it while running. |
Clientside or Serverside
Every Lua error happens on one side, and the console colours it by side:
| Colour | Side | Who can fix it |
|---|---|---|
| Yellow | Clientside: code running on your PC | You, if it's your addon. The server, if it came from the server. |
| Blue | Serverside: code running on the server | The server owner. You'll see these in singleplayer or when you host. |
| Green | The main menu's own code | Rare. Note it and report it. |
Red or white text that looks like an error isn't a Lua error. That's the engine itself.
On someone else's server, the errors you see are clientside. The server's own errors show in its console, not yours.
Find Which Addon Causes It
Read the Path
The path in the error usually names the addon folder. The Problems menu names Workshop addons for you.
Test Without Your Addons
Add -noworkshop to your launch options to start without Workshop addons. In Steam, right-click Garry's Mod, click Properties, then type it under Launch Options on the General tab. -noaddons does the same for addons you installed by hand.
Narrow It Down
If the errors stop, one of your addons is the cause. Remove -noworkshop, then open Addons and disable half your subscriptions. Restart and test again. Keep halving until you find the one.
Disable or Update It
Disable the addon, or check its Workshop page for an update or a known fix.
If the errors only happen on one server and not in singleplayer, it's that server's code. Your own addons are usually not the cause. Report it to the server instead.
Report an Error
Copy the full error with the Copy button in the Problems menu. Paste the text, not a screenshot.
A good report has:
- The full error text, including the numbered lines
- What you were doing when it happened
- Which server you were on, or that it was singleplayer
- The addon's name, if you know it
Send it to whoever owns the code:
- A Workshop addon: post on the addon's Workshop page, in its comments or bug discussion.
- A server's addon: use the server's bug report command, Discord or forum. On Justified, type
/bugin chat.
To save a long error to a file, add -condebug to your launch options. The game then writes everything in the console to console.log in your garrysmod folder.
Set lua_error_url on your server to a web address. Your server and every client connected to it then send each Lua error to that address as a POST request. The request holds the error text, stack, realm and the Workshop ID of the addon when the game can find it.
Garry's Mod has an achievement for this. Bad Coder unlocks when you "Experience 500 Lua programming errors".
If the game closes instead of showing an error, go to Garry's Mod Keeps Crashing. For more console commands, see the console reference.
Want a server to try it on? Justified is a Garry's Mod DarkRP server: justified.gg.
