v0.13.8

Errors and warnings

main · 4b0211c · latest release v0.13.8source on GitHub ↗

Every error and warning wowlua reports has a stable code. This page explains how the codes are built, how errors and warnings differ, and what each range of codes covers, with every code and its summary below.

186 errors50 warnings4 hints
severity

x01xx · Lexing and parsing · 19

x1xxx · Names, globals, modules, conditional compilation · 30

x2xxx · Types · 33

x3xxx · Classes, enums, decorators · 26

x4xxx · Manifest, packages, publishing · 64

x5xxx · Code generation and Lua limits · 4

x6xxx · Bundling and minification · 4

x7xxx · Debugging and reflection · 3

x8xxx · Standard library · 53

P7xxx · Performance hints · 4

186 errors50 warnings4 hints

by area · tap one to open it

x01xxLexing and parsing19
x1xxxNames, globals, modules, conditional compilation30
E1001Undefined global read (strict mode)E1002Implicit global assignment (strict mode)E1003Undefined local or upvalue in a wowlua construct (e.g. a decorator argument)E1004A parameter's default reads that parameter or a later one, which is not set yet (in Lua every parameter is in scope there, so the name is the parameter, not an outer one)E1010Assignment to an exported or imported bindingE1011Top-level import after another (non-import) statementE1012Module has no export with this nameE1013Module specifier case does not match the file on diskE1014Import or usage cycle containing a load-time edge (run-time-only cycles are allowed)E1015Module not foundE1016An export redeclares a module-level name (a local, function, import, …), or a name is exported twiceE1020Reference to a declaration removed by @if or static eliminationE1031Duplicate type name in the same scope: two (non-ambient) interfaces, or any two of an interface, a type alias, a class and an enumE1032Top-level return in a moduleE1035build.load-order contradicts a computed load-time dependencyE1036Flavors need incompatible load orders and toc-layout = "single" is forcedE1037Hoisted declaration used at load time before its definition has executedE1038asset() path is not a package asset (or case mismatch)E1039@if(flavor …) in a .wowlua file in shared flavor modeE1040@if condition is not a static conditionE1041Value import of another addon's module (an addon-dependencies addon): only import type crosses addonsW1001Undefined global read (basic mode)W1002Implicit global assignment (basic mode)W1003Unused local, parameter or importW1004Local shadows another local, or a local function is named like a local of the same block; also a parameter named self inside a class's method or constructor, which hides the instance (a plain function M:m()'s self may be shadowed, as frame handlers do)W1005Unreachable codeW1033Load order cannot be determined (dynamic names, several writers, external names); files keep their source orderW1034Name read at load time but only defined at run timeW1035Usage-analysis dependency contradicts build.load-order; the listed order is kept (contradicting imports are E1035)W1036A module of an import cycle reads an export (or, with import internal, a file-level local) of a module of the cycle checked after it that has no type annotation (or a typeof type alias it has not reached): it is any there
x2xxxTypes33
E2001Type mismatch: S is not assignable to TE2002Unknown type nameE2003Unknown field or method (also: method defined outside its class body, assignment to the reserved __wowlua key)E2004Value is not callableE2005Value may be nil (strict mode)E2006Too many argumentsE2007Missing argumentE2008Method called without self (use :)E2009Not all code paths return a valueE2010Assignment to a const, readonly field, read-only accessor, enum member or wowlua:meta fieldE2011Access to a private / protected memberE2012No overload matches the callE2013Wrong number of type argumentsE2014Type argument does not satisfy its constraintE2015Type assertion between incomparable typesE2030API not available in every flavor (shared flavor mode), missing a flavor guardE2040Forbidden operation on a possibly secret value (strict mode)E2050Missing parameter type annotation (strict mode)E2051Unknown field added to a sealed table (strict mode)E2052Non-optional class field not definitely assigned in the constructor (strict mode): before it returns or calls one of its own methods on self, which may read the field (the message names that call when the field is assigned after it)E2053Recursive type alias not guarded by a table or function typeE2054Conflicting field types in merged declare interface declarationsE2056Type pack used in an invalid positionE2058Name declared both as declare event and declare messageE2059Default value in a declare event / declare message parameterE2060A local after an annotated one is named after a type (local a, b: T, U: the annotations go on each name, local a: T, b: U)W2040Forbidden operation on a possibly secret value (basic mode)W2055Too many arguments to an unannotated function (basic mode). Replaces the second meaning of W2006.W2057coroutine.yield inside a function passed to pcall/xpcall/a C callback (cannot yield across that boundary in Lua 5.1)W2060Division or modulo by a literal zero: WoW raises "Division by zero" (any mode)W2061a and nil or b (or false in the middle) is always b: the falsy middle value makes the or take over (any mode)W2062A value read past what a function of the package can give (a local function, a module's or an imported function, a file-level table's method; (each of its returns a fixed number of values) is always nil: a name past them in a local or an assignment, or select(n, …) with a literal n past them; and a name past an and or or of a call ending a local or an assignment (local x, y = pos and pos:GetXY(): the operator keeps one value, decision L73) (any mode)W2063A parameter without an annotation that nothing gives a type (no expected function type, or one that says any), or a local without an annotation whose value is any, or a generic type written without its type arguments (Box for Box<T>: they are any; decision T276), or a member a widget class doesn't declare, read or set through the openness of the game's frames (decision L51): it is any without saying so. Off unless check.lints sets it ("W2063": "warn"); names starting with _ are exempt (decision T274)
x3xxxClasses, enums, decorators26
E3001super(...) missing, repeated, or after use of selfE3002Cannot instantiate an abstract classE3003Abstract method not implementedE3004Reserved member nameE3005override problem: missing override, or nothing to overrideE3006Class does not satisfy an implemented interfaceE3007Metamethod on a widget classE3008Class extends a non-class value, or a class only import type bringsE3010Enum mixes numeric and string valuesE3011Duplicate enum valueE3020Unknown decoratorE3021Decorator not applicable to this target (including user decorators on enums, interfaces and aliases)E3022User decorator signature does not accept the targetE3032Invalid @debugOnly function (returns values, or a call is used as an expression)E3033@intrinsic used outside compiler-known modulesE3040Local or parameter named super inside a class bodyE3041... used in a field or static initializerE3042Field and method/accessor with the same name (in a class or across its superclass)E3043Accessor declared on a widget classE3044Overload implementation does not accept every overload signatureE3045Statement-only wowlua:debug helper used as a valueE3046A field declared twice in one class (a constructor's parameter property included)E3047overload function signature not followed by its implementationW3021Lexical binding named like a core decorator is not a re-export of it (ignored in decorator position)W3030Use of a @deprecated declarationW3031@inline ignored
x4xxxManifest, packages, publishing64
E4001Manifest is not valid JSONE4002Manifest does not match the schema (unknown key, wrong type)E4003Invalid package name or versionE4004Unknown flavorE4005Conflicting setting between .pkgmeta and wowlua.json in compatibility modeE4006Unknown profile, minification level, publish target or bundled addon referencedE4007Cyclic profile or minification-level inheritance (inherits / extends)E4012Profile config key missing from the top-level config, or with an incompatible typeE4101Version conflict in dependency resolutionE4102Dependency not found (registry, git ref, path)E4103Checksum mismatchE4104Lockfile out of date (--locked)E4105Network access required (--frozen / --offline)E4110Cannot determine the load order of a lua-library. Specify files.E4120SavedVariables name used by several addons in the workspaceE4201Missing API token for a publish targetE4202Upload rejected by the site (the site's response is included)E4210CurseForge upload without a changelogE4230Addons cannot be published to the wowlua registryE4231A package for the wowlua registry depends on a non-registry source (git, svn, path, archive)E4300Running compiler does not satisfy package.wowlua (checked before schema validation)E4301toc-layout: "single" forced, but a targeted client lacks a needed TOC featureE4302Per-flavor TOC names cannot distinguish the targeted flavorsE4303TOC line longer than 1024 characters that cannot be split (non-appendable directive or file line)E4307asset() path does not name an asset of the buildE4308Output paths differ only in caseE4311Output path collides with a reserved top-level name or another output fileE4312addon.load-on-demand: false together with addon-dependencies.load-withE4314Feature entry names an unknown feature, unknown dependency, or non-optional dependencyE4315Custom profile without inheritsE4316Workspace member sets its own build.outE4317addon section in a non-addon packageE4318Targeted flavor has no types package or pinned interfaceE4319VCS tag does not match package.version (tagged release build / --tag)E4320Lockfile written by a newer compiler (unsupported lockfile version)E4321Same package name from two different sources in one addon's graphE4323Unsafe archive/checkout content (absolute path, .., escaping symlink or hardlink)E4324Cycle of required addon dependencies within a workspaceE4325Two workspace members with the same addon.nameE4327Library does not support a targeted flavor (and the dependency is not restricted with flavors)E4330--tag names an existing tag that points at another commitE4331dev/install refuses to overwrite an AddOn folder not installed by wowlua (no X-Wowlua-Build); use --forceE4334Both a hand-written Bindings.xml and wowlua:bindings declarationsE4335Packager @version-…@ blocks in a multi-version buildE4336wowlua publish with uncommitted changes in the working tree (without --allow-dirty)E4400World profile is not valid JSON, or not a JSON objectE4401World profile does not match its schema (unknown part, wrong type, a key that is no ID, a UI scale off the game's slider, a character's level outside the flavors' range, a powers key that is no power token, a faction that is not the race's, a race and class no flavor pairs)E4402test.profile or a test file's config({ profile }) names no world profile of the packageW4001Unknown TOC directive in addon.toc-extraW4030Unsupported packager keywordW4031Packager @retail@ blocks left as written in a multi-version buildW4220Flavor unknown to a publish site and omitted from that uploadW4304Flavors' load orders conflict; falling back to per-flavor TOC layoutW4306Embedded library without a recognizable license file or headerW4309--link could not create a symlink/junction; copying insteadW4310XML reference differs in case from the referenced file (the client resolves it case-insensitively)W4313types sync moved a client alias (anniversary, forever) to another rulesetW4322Locked version has been yankedW4326No OS credential store; token stored in config.json (mode 0600)W4328Site does not know the exact game version; fell back to a lower/highest versionW4329GitHub target skipped: build is not on a tag and no --tag givenW4332.pkgmeta move-folders use that cannot be convertedW4333.pkgmeta hg external cannot be convertedW4337build.load-order entry that names no file of the build
x5xxxCode generation and Lua limits4
x6xxxBundling and minification4
x7xxxDebugging and reflection3
x8xxxStandard library53
E8001send used with a WoW event (only messages can be sent)E8002@event on an instance methodE8003Unknown event or message nameE8010Duplicate slash commandE8020saved.bind on a SavedVariable not declared in the manifestE8021Profiles enabled without the per-character profile SavedVariable (<name>PerChar)E8030Deferred-call decorator on a function that returns valuesE8050Addon message prefix too longE8060Invalid locale keyE8061Locale file defines a key unknown to the base localeE8063Locale string uses different placeholders than the base localeE8070Settings control bound to a field of the wrong typeE8080launcher.register called more than once (compile time for top-level calls, otherwise at runtime)E8101Invalid slash command name (must start with /, no whitespace)E8102saved.bind name is not a string literalE8103SavedVariable bound twice with saved.bindE8104saved.bind defaults type contains Secret<…>E8105Invalid locale file name or unknown locale codeE8106Base locale file missingE8107Settings dropdown option value not in the field's typeE8108wowlua:test / wowlua:mock imported outside a test fileE8112Slash router (router, Router:add): invalid ArgSpec, or run parameters don't match args/flagsE8113Settings control key not found in the store's typeE8114settings.register called more than onceE8115Locale file is not a JSON object of stringsE8117profiles = true on a per-character SavedVariableE8118wowlua:log level function used as a value (cannot be stripped)E8119import internal outside a test fileE8120A @cases case does not match the test function's parametersE8121A matcher used on a value of a kind it does not take (toHaveLength on a number)E8122An @expectError function gives other diagnostics than it namesE8123mock.module replaces an export the module does not haveE8300Standard-library function unavailable on a targeted flavor (no fallback)E8310Invalid token in a literal aura filterE8330Unknown tooltip kindE8340Movable frame store field is not of type FramePosition?E8350@binding / header not at module top level, or with non-constant argumentsE8351Duplicate keybinding name in the addonE8352Invalid keybinding name (must match [A-Z][A-Z0-9_]*)E8353settings.keybinding references a binding not declared with @bindingE8390Invalid color hex literalE8400Unknown media kindE8420Unknown callback event name for the registry's event typeE8440Invalid macro conditional in a literal state driver (brackets, or an unknown condition)E8441Visibility driver value other than show or hideW8011Slash command collides with a Blizzard commandW8040Hook target not declared (not reported inside an existence test of the same member, if obj.Method then)W8062Locale is missing translations (summary per locale)W8101Event not available in every selected flavor (shared flavor mode); registered with a runtime validity checkW8102Hook target belongs to a load-on-demand addon but opts.addon is missingW8301Standard-library function uses a reduced fallback on a targeted flavor (lists missing fields or features)W8354Binding default key ignored on a flavor without default-key supportW8430Job yield call (check/yield/sleep/waitFor) inside pcall/xpcall/securecall*, a metamethod or a C-function callback
P7xxxPerformance hints4

Reading a code

A code is a letter and four digits, such as E2001:

  • The letter is the kind: E for an error, W for a warning, P for a performance hint.
  • The first digit is the area, such as 2 for types. For lexing and parsing the area is 01, so those codes start E01.
  • The rest numbers the problem within its area.

Some problems come in both kinds, one per check mode: E1001 is an undefined global read in strict mode, W1001 the same read in basic mode. The code is the same in the terminal, in VS Code and in --message-format json, so you can search for it.

error[E2001]: `"three"` is not assignable to `number`
  ┌─ src/main.wowlua:1:7
  │
1 │ local count: number = "three"
  │       ^^^^^ here

Errors, warnings and hints

An error fails the command, which exits with status 1. A warning is printed and the command goes on. With --deny-warnings, any warning fails the command too, which suits CI.

warning[W1003]: unused local `unused`
  ┌─ src/main.wowlua:2:7
  │
2 │ local unused = 1
  │       ^^^^^^ never read
  │
  = help: remove the unused local

P codes are different. The compiler never reports them: the dev window finds them in the game while your addon runs, from what it measures, and they never affect a build. See Debugging.

Warnings in plain Lua files

Plain Lua is checked more gently. In a file that uses no wowlua syntax, a .lua file or a .wowlua file written in plain Lua, every name, type, flavor and secret-value error (the E1xxx and E2xxx codes) is reported as the warning with the same number: E2001 becomes W2001. Those warning forms are not listed separately below; they mean what their E code means.

warning[W2001]: `"wide"` is not assignable to `number`
  ┌─ src/plain.lua:2:15
  │
2 │ frame:SetSize("wide", 10)
  │               ^^^^^^ here

.lua files are only type-checked when the manifest sets "check": { "lua": true }. A file whose first line is --!strict gets the errors instead of the warnings.

Changing a warning's level

check.lints in wowlua.json changes the level of any warning, the plain Lua forms included: "allow" hides it, "deny" makes it an error, "warn" keeps it a warning.

json
"check": {  "lints": { "W1003": "allow", "W1004": "deny", "W2001": "allow" }}

Only W codes go there; errors can't be turned down (E4002). One warning is off until you turn it on: W2063, a value that is silently any, which reports with "W2063": "warn". The manifest reference has the rest of check.

wowlua explain

wowlua explain prints what a code means, without a network connection: its summary, how to fix it, an example that reports it and one that compiles, and related codes.

terminal
$ wowlua explain E2001
E2001 (error): Type mismatch: S is not assignable to T

A value's type doesn't fit where it is used: an argument, an assignment to an
annotated local or field, or a return value. The same code covers an operator
used on a type it doesn't take, such as comparing a number with a string or
doing arithmetic on a boolean. Change the value, or widen the annotation if
the value is right.

In a plain Lua file (no wowlua syntax, no `--!strict`) the checker reports the
warning with the same number, W2001, so existing code keeps building.

Reports it:
    local count: number = "3"
    print(count)

Compiles:
    local count: number = 3
    print(count)

Related: W2001, E2005

https://wowlua.dev/docs/reference/diagnostics/E2001

Lowercase works too (wowlua explain w1003). For the warning form of a plain Lua file, ask for its E code. The command cheat sheet lists the other commands.

x01xx: Lexing and parsing

The file could not be read as code: an unexpected token, a string or long bracket that never ends, a malformed number. This range also covers wowlua's own syntax used in the wrong place, such as continue outside a loop, import inside a function, a decorator with nothing to decorate, or ?? mixed with and and or without parentheses. See Syntax and sugar.

x1xxx: Names, globals, modules, conditional compilation

What a name refers to. Undefined globals and implicit global assignments (errors in strict mode, warnings in basic mode), unused and shadowed locals, unreachable code, imports of missing modules or exports, and import cycles that matter at load time. Load order belongs here too: a name read while the addon loads that is only defined later, or a build.load-order the code contradicts. So does conditional compilation: a reference to a declaration @if removed, or an @if condition that is not static. See Modules and Build info and profiles.

x2xxx: Types

The type checker. Type mismatches, unknown types, fields and methods, wrong argument counts, values that may be nil in strict mode, assignments to constants and read-only fields, access to private members, and missing returns. APIs that not every flavor has (in shared flavor mode) and operations on secret values are here as well. Some warnings catch Lua mistakes in any mode, such as a division by a literal zero or a and nil or b. See Types.

x3xxx: Classes, enums, decorators

Classes and their members: a missing or misplaced super(...), instances of abstract classes, unimplemented abstract methods, override problems, interfaces a class doesn't satisfy, and widget classes that use what frames can't have. Enums that mix numbers and strings or repeat a value, unknown decorators and decorators on the wrong target, and uses of @deprecated declarations. See Classes and Decorators.

x4xxx: Manifest, packages, publishing

Everything around the code. x40xx is wowlua.json itself (invalid JSON, unknown keys, wrong types) and settings read from .pkgmeta. x41xx is dependencies and the lockfile, x42xx uploads to the publish sites, and x43xx the TOC, flavors, the build's output files, workspaces, version tags and installing into the game. x44xx is world profiles. See wowlua.json, Libraries and dependencies and Building and publishing.

x5xxx, x6xxx, x7xxx: Code generation, bundling, debugging

x5xxx is the Lua wowlua writes: a Lua 5.1 limit exceeded (too many locals, upvalues or constants in one function), and output that fails validation, such as a TOC or XML file that names a file the build lacks.

x6xxx is bundling and minification: an unknown minification pass, a module that dead-code removal dropped, code that reads Lua file names that bundling changes, and minified code sent to CurseForge, Wago or WoWInterface, which Blizzard's AddOn policy forbids.

x7xxx is debugging and reflection: todo() left in a release build, reflection asked for in a profile that turns it off, and nameof with an argument it can't name. The P7xxx performance hints share this range: P71xx events and scripts, P72xx garbage and memory, P73xx frame time. See Debugging helpers.

x8xxx: Standard library

Mistakes in using the wowlua:* modules that the compiler can see: unknown event names, duplicate slash commands, saved.bind on a SavedVariable the manifest doesn't declare, locale files that don't match the base locale, settings controls bound to the wrong field, invalid keybinding names, and test helpers imported outside tests. x80xx to x82xx are the first modules (events, slash commands, saved variables, hooks, locales, settings and tests), x83xx to x85xx the game data, interface and infrastructure modules (flavor fallbacks, auras, tooltips, frames, keybindings, colors, media, callbacks, jobs, state drivers). See the standard library overview.

main · 4b0211csource on GitHub ↗