Skip to main content

Overview

When connected to SRCDS, GLuaLS captures runtime Lua errors in the GLua Errors panel. Each error includes a clickable stack trace that jumps to the offending line in your source files.

How it works

The gm_rdb binary module (installed as part of debugger setup) intercepts Lua errors at the SRCDS runtime level and streams them to the extension over the debug connection. You do not need a breakpoint. GLuaLS captures errors whenever the debugger is connected.

The Errors panel

Open the Errors panel from the GLuaLS sidebar, or via View → GLua Errors. Each entry shows:
  • Error message: the Lua error string
  • Source: whether it came from a Lua error or the console
  • Count: how many times this error occurred, deduplicated by fingerprint
  • First / last seen: timestamps
  • Stack trace: click any frame to jump to that file and line

Click any stack frame in the error entry to open the file and jump to the exact line. GLuaLS resolves short Garry’s Mod file paths, such as addons/my-addon/lua/my_file.lua:42, to absolute paths in your workspace.

Error sources

SourceDescription
LuaRuntime Lua errors caught by the GMod error system
ConsoleError-level messages from the SRCDS console output

Clearing errors

Click the Clear button at the top of the panel to clear all current errors. Errors persist until cleared or until the debug session ends.

Stop on error

You can configure the debugger to pause execution when Lua throws an error. This lets you inspect the full call stack at the moment of the error. Set stopOnError: true in your launch.json:
launch.json
{
  "type": "gluals_gmod",
  "request": "attach",
  "name": "Attach to SRCDS",
  "host": "localhost",
  "port": 21111,
  "sourceRoot": "${workspaceFolder}",
  "stopOnError": true
}
stopOnError pauses the game when any Lua error occurs, including those in addons you didn’t write. Use it selectively during focused debugging sessions rather than leaving it on permanently.