Skip to content
Back to skills

Gum Tool Errors

ASecurity

Gum error detection and display, including GUM0009 (variable reference that never applies). Triggers: Errors tab, ! icons in tree view, ErrorChecker, HeadlessErrorChecker, ErrorViewModel, IErrorChecker, AllErrorsViewModel, MainErrorsPlugin, RequestErrorRefreshMessage, adding new error checks.

  • 666 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 7, 2026
designgoreactexpress

Works with

  • cli

Security analysis

A100/100

Scanned November 24, 2026

npx -y skills add vchelaru/Gum --skill gum-tool-errors --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Gum Tool Errors?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Gum Tool Errors
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vchelaru-gum-tool-errors/badge)](https://www.skillsdirectory.com/skills/vchelaru-gum-tool-errors)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: gum-tool-errors
description: "Gum error detection and display, including GUM0009 (variable reference that never applies). Triggers: Errors tab, ! icons in tree view, ErrorChecker, HeadlessErrorChecker, ErrorViewModel, IErrorChecker, AllErrorsViewModel, MainErrorsPlugin, RequestErrorRefreshMessage, adding new error checks."
---

# Gum Tool Error System Reference

## Architecture

Two tiers of error detection, merged into one display.

**Tier 1 — Core checks** (`ErrorChecker`): Runs on a given `ElementSave`. Called by both the tree view (icon refresh) and the Errors tab (list refresh).

**Tier 2 — Plugin checks**: Plugins implement `GetAllErrors` event (declared on `PluginBase`) and return `IEnumerable<ErrorViewModel>`. Called via `PluginManager.FillWithErrors()`, which is invoked at the end of `ErrorChecker.GetErrorsFor()`.

## Error Pipeline

```
Plugin notification (VariableSet, InstanceAdd, StateAdd, Undo, ...)
    ↓
MainErrorsPlugin or MainTreeViewPlugin (never both for one notification)
    ↓
ErrorChecker.GetErrorsFor(element, project) → raises IErrorChecker.ErrorsChecked
    ├─ MainErrorsPlugin: fills AllErrorsViewModel.Errors (the Errors tab)
    └─ MainTreeViewPlugin.HandleErrorsChecked → ElementTreeViewManager.UpdateErrorIndicatorsForElement
```

The tree's "!" follows every full check through `ErrorsChecked`, including the Errors tab's.

## Adding New Error Checks

**Core check** (missing references, structural problems): Add it to `HeadlessErrorChecker.GetErrorsForInternal` in `Gum.ProjectServices`, **not** the tool's `Tools/Gum.Presentation/Managers/ErrorChecker.cs`. The tool's checker delegates to the headless one (and converts `ErrorResult` → `ErrorViewModel`); putting checks in the headless layer means both the tool's Errors tab (per-selected-element refresh) and `gumcli check` (whole-project pass via `GetAllErrors`) surface them automatically. Pattern: iterate states/instances, emit `new ErrorResult { ElementName = ..., Message = ..., Code = "GUM00XX", Severity = ... }`. Register the code in `ErrorDocsRegistry` to get a help URL.

**Every result needs a code and, when the message names values, a `Details` object** (`Tools/Gum.ProjectServices/ErrorDetails.cs`). Tools and `gumcli check --json` read the code and `Details`, and message wording may change, so the values go in `Details` too. Reuse a shared subclass such as `StateVariableDetails` or `CycleDetails` when it has the same shape.

**Project-level check** (not tied to one element): add it to `ProjectErrorCheck` (`Tools/Gum.ProjectServices/ProjectErrorCheck.cs`), which `GetProjectErrors` runs; not the per-element check. The Errors tab lists project-level rows whatever is selected, alongside the selected element's rows. The tool runs it through `BackgroundProjectErrorCheck`: `PrepareNext` reads the project in UI-thread slices and `Check` runs on a worker thread, so a new check reads the model only in the prepare half and keeps strings for `Check`, and its disk calls go through a `PreparedWalk` (`GumProjectDependencyWalker.Prepare`) or the check's own `IFileNameCaseChecker`.

**Plugin check** (feature-specific, tool-side only): Subscribe to `GetAllErrors` in your plugin's `StartUp()`, return `IEnumerable<ErrorViewModel>`, and set `item.OwnerPlugin = this` on each. Plugin checks only show in the tool — the CLI doesn't load plugins. If the check should fire in CI / pre-commit, use the headless path above instead.

**Fixable errors**: set `ActionName` and `ActionCommand` on the `ErrorViewModel` to render a button beside the row that resolves the error in place (`HasAction` drives its visibility). An action that destroys anything unrecoverable still owes the user a confirmation before it runs.

**Triggering refresh**: Send `RequestErrorRefreshMessage` via messenger; the Errors tab re-checks the selected element and the tree icon follows.

## Current Core Checks (ErrorChecker)

| Method | What it detects |
|--------|----------------|
| `GetBehaviorErrorsFor` | Missing behavior references; missing/wrong-type required instances and variables |
| `GetMissingElementBaseTypeErrorFor` | Element's own base type points to a deleted/nonexistent element |
| `GetMissingBaseTypeErrorsFor` | Instance's base type points to a nonexistent element |
| `GetParentErrorsFor` | An `X.Parent` variable names a parent instance the element lacks (only the part before a dot is tested). GUM0034 when `X` exists; GUM0048 (`StaleVariableDetails`) when `X` is not an instance either, so the fix is deleting the variable. A stale `X` with a valid parent reports nothing |
| `GetInvalidVariableTypeErrorsFor` | Custom variable uses an unknown or misnamed type (State suffix issues) |
| `GetMissingSourceFileErrorsFor` | GUM0004: element file missing on disk; GUM0008 when it exists under a different case |
| `GetMissingExternalFileErrorsFor` | GUM0006: referenced texture/font file missing (via `GumProjectDependencyWalker`); GUM0008 for a case-only difference |
| `GetFontRangeEntryErrors` | Project-level warnings: GUM0010 a font-specific `FontRangeEntries` entry no Text's font reaches, GUM0011 an entry whose range `BmfcSave.GetIfIsValidRange` rejects (BMFont bakes the default, KernSmith drops the unreadable parts). GUM0010 runs `FontReferenceCollector` (through `FontRangeEntryChecker`, which the Fonts settings page also uses) over the project only when such an entry exists |
| `GetTextOutsideFontRangeErrorsFor` | GUM0012 (warning): a literal `Text` value in any state has characters its font's ranges (`GetFontRanges`) leave out; skips pre-baked `.fnt` and GUM0011-invalid ranges |
| `GetOrphanCodeFileErrors` | GUM0005 (warning, project-level): code files no element accounts for. Runs only when the checker is given an `IOrphanCodeFileProvider`: `gumcli check` passes `HeadlessOrphanCodeFileProvider` (sync disk scan); the tool passes none, because its async `OrphanCodeFileReporter` keeps the scan off the UI thread and adds the Delete File / Migrate actions. Both build the scan from `OrphanCodeFileScanPipeline.Create` and rows with `OrphanCodeFileErrors.Create`, so wording and `OrphanCodeFileDetails` match |
| `GetUnresolvableVariableReferenceErrorsFor` | GUM0009 (warning): a `VariableReferences` line reads an element, instance or variable the project doesn't have, so it never applies. The end-to-end oracles fail on it despite the warning severity. A line reading a Forms-behavior property resolves only stored values, with no behavior-default fallback (see `gum-forms-behaviors`, "Two Layers in One Variable List") |
| `FindEvaluationProblem` | GUM0047 (warning): a line whose names all exist that Gum.Expressions cannot evaluate (parse error, division by zero), through `ElementSaveExtensions.FindEvaluationProblem`, so the runtime and the check use one wording |

## Key Files

| File | Purpose |
|------|---------|
| `Tools/Gum.ProjectServices/HeadlessErrorChecker.cs` | All core error checks |
| `Tools/Gum.Presentation/Managers/ErrorChecker.cs` | Tool wrapper: headless checks + plugin checks; raises `ErrorsChecked` |
| `Tools/Gum.Presentation/Managers/ErrorViewModel.cs` | Data model (`Message`, `OwnerPlugin` — `object?`, headless `Gum.Presentation`, ADR-0005) |
| `Tools/Gum.Presentation/Plugins/InternalPlugins/Errors/MainErrorsPlugin.cs` | Errors tab plugin; handles `RequestErrorRefreshMessage` |
| `Tools/Gum.Presentation/Plugins/InternalPlugins/Errors/AllErrorsViewModel.cs` | ObservableCollection of errors; `CountDescription` for tab header (headless `Gum.Presentation`, ADR-0005) |
| `Tool/TreeViewPlugin.Core/MainTreeViewPlugin.cs` | Tree "!" indicator; checks only on notifications the Errors tab doesn't |
| `Tool/TreeViewPlugin.Core/ElementTreeViewManager.cs` | `UpdateErrorIndicatorsForElement` |
| `Tools/Gum.Presentation/Messages/RequestErrorRefreshMessage.cs` | Message to force an error refresh |
| `Tests/Gum.Presentation.Tests/Managers/ErrorCheckerTests.cs` | Unit tests for ErrorChecker |

## Element Reload and Errors

When an element file changes on disk, `FileChangeReactionLogic.ReactToElementSaveChanged` calls `_pluginManager.ElementReloaded(element)`. `MainErrorsPlugin` subscribes to `ElementReloaded` and calls `UpdateErrorsForElement` — this is the correct trigger for refreshing errors after a reload.

Do **not** rely on `ElementSelected` alone for error refresh after reload: the reload path temporarily sets `SelectedElement = null` (to force a UI reset), which clears errors, and the subsequent re-selection uses `file.StandardizedNoPathNoExtension` which fails to find elements in subfolders — so errors would never be repopulated.

## Non-Obvious Behaviors

**One check per notification**: a check walks the element's file references and reads the disk, so a notification triggers a check in only one plugin. A new refresh trigger for the selected element goes in `MainErrorsPlugin`; the tree picks up the result. The tree only checks where the Errors tab doesn't (states, categories, undo, behavior instances, all elements on project load). The load-time check runs after the tree shows, a slice per UI-thread job (`DeferredProjectErrorCheck`), so the "!" icons fill in while the tree is usable.

**Case-check listings are cached**: `HeadlessErrorChecker` keeps one `FileNameCaseChecker` for its lifetime. It re-reads a directory only when that directory's last-write time changes, so a new GUM0008 check doesn't need its own `FileNameCaseChecker`.

**Font collection dominates file walks**: every `GumProjectDependencyWalker` walk with `ExternalFiles` runs `FontReferenceCollector` to find `.ttf` references, and that CPU cost dwarfs the disk calls. The checker, the file watch and font generation get their `FontReferenceCache` from `IFontReferenceCacheSource`: the CLI makes a new one per check, and the tool's `ProjectFontReferences` keeps one until `IProjectChangeVersion` moves, which `PluginManager` does around every notification not listed in `NotificationsThatChangeNothing`. A cache ignores edits, so code that changes the project without a plugin notification must call `IProjectChangeVersion.MarkChanged()`, and a new read-only notification goes in that list. After a load, `ProjectFontWarmUp` fills the cache in UI-thread slices, and a project-wide pass queued then goes through `IProjectFontWarmUp.PostAfterWarmUp` so it finds the fonts collected. A project opened through an 8.3 short path (`VICPER~1`) makes every `File.Exists` expand the path, which about doubles the file checks, so time load measurements on a long path.

**The Errors tab never goes stale for speed**: a faster file-watch path must keep every file that can change the list in `IFileWatchManager.IsRelevantToProject`. `ProjectReferencedFiles` adds `.ttf`/`.otf` values of `Font` back by reading raw variable values, since its walk skips font resolution.

**Cache wrapping**: `ErrorChecker.GetErrorsFor` wraps its checks in `ObjectFinder.Self.EnableCache()` / `DisableCache()`. New checks added inside the method benefit from this automatically.

**`IsSourceFileMissing` is separate**: The tree view shows "!" if `element.IsSourceFileMissing || hasErrors`. Source file missing is not surfaced as an `ErrorViewModel` — it's a flag on the element itself, checked directly by `UpdateErrorIndicatorsForElement`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in design →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.