Error codes
92 codes
Every code the compiler puts on a diagnostic, read from its two registries at commit af54ddad5. The "use typeshade" front end has 51 codes and the core IR layer under it has 36.
51 pages carry a program that raises the code and the same program fixed. Both are compiled at build time against the pinned compiler, and the build stops when a program no longer raises its code or a fix no longer compiles clean. A row with an Example tag is one of them.
The registry text and every compiler message on these pages are the compiler's own English.
Front-end codes
The TS80xx codes, from TS_CODES in the front end. A "use typeshade" file is checked against these before any IR is built.
The file
-
TS8001MISSING_DIRECTIVEExample - A file compiled as TypeShade that has no
"use typeshade"directive at all. -
TS8013HOST_STMTExample - Host control flow and JavaScript runtime forms that no shader has:
await,yield, anasyncor generator function,try/catch/throw,for…in,var, a spread outside an object literal and a template string. Anewis a class rule,CLASS_MEMBER. -
TS8014TOP_LEVELExample - Something at the top level of the file the compiler cannot declare: a bare statement, or a module-level declaration of a shape it refuses.
-
TS8030SYNTAXExample - A TypeScript parse error in a
"use typeshade"file, such as an unclosed parenthesis, a missing brace or an unexpected token. The file is not lowered or emitted. The language service shows TypeScript's own syntactic diagnostic in its place. -
TS8050ENABLE_NAMEExample - A file-level
"enable <extension>";directive that names an extension outside the vocabulary of the WGSL backend's capability profile. A misspelled name would otherwise be an ordinary string statement and silently enable nothing. -
TS8072IMPORTExample - An import that the compiler does not follow (Rule 3.9): a path that names no file or one that this compile cannot read, a file that is not a shader module, a package that no
node_modulesholds, a subpath that a package'sexportsdoes not name, a name that the module does not export, or a form that a shader module has no use for (a default import or export, an import that names nothing,import(...),require). -
TS8099UNSUPPORTEDExample - The catch-all for a diagnostic whose site does not yet deserve its own code. It stays parked at TS8099, past the sequential range.
Types and names
-
TS8002UNKNOWN_TYPEExample - A type name that nothing declares, in a parameter, a type argument, an alias, an
implementsclause or a base class, or a type that this surface does not take where the mapper reads one (Rule 2.1). A base that the file declares and does not collect as a struct isSTRUCT_FIELD. -
TS8003TYPE_MISMATCHExample - Two types that do not fit where they meet (an operator, a condition, a declaration, a return or an argument), a read of an optional value (
T | undefined,T | nullorT | null | undefined) that no test narrowed (Rule 7.10), or a constant the compiler folds that WGSL refuses: a shift amount past 31, a divisor of 0, clamp bounds that cross, anf32past its range or a builtin call outside its domain, such asMath.pow(-2., 2.). -
TS8005CONST_ASSIGNExample - An assignment to a name or a place that cannot change: a
constnumber or vector, a component of aconstvector or matrix, areadonlyfield or static, or a storage binding thatreadonlyor"read"promises is never written. A write to a field or an element of aconstobject is not one of these, because theconstholds the object and the object stays writable, as in JavaScript (Rule 6.10). -
TS8010STRUCT_FIELDExample - An invalid struct field or declaration shape. A class with no fields is accepted; this code covers an invalid field declaration, an empty struct that is not a class, an
@alignon a field, which is not applied, and a user-defined value whose uses give it two locations (Rule 6.6). -
TS8016INDEX_OOBExample - A constant index outside the length of what it indexes.
-
TS8018ASSIGN_TARGETExample - An assignment or
++/--target that is not a writable place, such as a temporary. An unknown name isUNKNOWN_NAME, and a write to a known immutable binding isCONST_ASSIGN. -
TS8022UNKNOWN_NAMEExample - A reference to a name that TypeShade cannot resolve and that is not a function call (
UNKNOWN_FN) or a type name (UNKNOWN_TYPE). A name that the library declares for TypeScript's own use (Object,Math,Symbol), or that the file declares as an enum, a namespace, a class or a type, and that is read as a value, says what it is. -
TS8023DUPLICATE_SYMBOLExample - The same function, binding, module constant or struct name declared twice in one scope. A struct counts whichever spelling each declaration uses: a class, an interface and a type alias of one name are one struct, so a second declaration is a duplicate.
-
TS8068RESERVED_NAMEExample evalorargumentsbound by a variable, a parameter or a function, which ECMAScript's strict mode, and TypeScript with it, lets no declaration do (Rule 2.1).-
TS8075UNASSIGNED_READExample - A read of a local before it is assigned on every path (Rule 7.6), by TypeScript's rule for its TS2454. An argument is a read, and no call assigns the caller's local. The editor shows this code where TypeScript reports TS2454.
Functions and classes
-
TS8004UNKNOWN_FNExample - A call to a function the file neither declares nor imports, or to a builtin the language removed because ECMAScript spells it, such as
arrayLength(xs), whose message namesxs.length(Rule 9.9). -
TS8019ARITY_MISMATCHExample - A wrong number of arguments, elements or fields at a call or a constructor.
-
TS8020FUNCTION_SHAPEExample - A function declaration or parameter shape that TypeShade does not support, such as a missing name or body, a rest parameter or a destructured parameter.
-
TS8021RETURN_SHAPEExample - A
returnof the wrong shape: a barereturnwhere a value is required, a function that returnsundefinedand no value, or a compute entry with no return type annotation that returns a value. -
TS8031RECURSIONExample - A call cycle: a function that reaches itself, directly or through other functions. WGSL has no call stack, so the compiler refuses the cycle before a target sees it.
-
TS8035CLASS_MEMBERExample - A class member shape that the surface does not take, a use of a member that the class rules refuse, or a
newthat builds no class (Rule 8.13). Getters and setters, static fields and methods, overload signatures, abstract members,#private names and methods that change their object all compile. The message names the member or the target and the edit. -
TS8036MATH_ARGUMENTExample - A math builtin called with arguments that its signature does not take: two shapes that had to agree (
dot(vec3, vec2)), an element kind that the builtin has no form for (sinon an integer vector), a scalar where a vector is due (normalize(s)), or a factor, exponent, offset or count of the wrong type. The message names the offending argument and, where one is short, the fix: splat the scalar, cast one side, or give the vectors one size.
Control flow
-
TS8006LOOP_BOUNDExample - A loop whose condition the compiler refuses: a
forwith a constant start, bound and step whose counter leaves the range of its type before the condition fails, or a call that writes inside a loop condition. Afor...ofover an array that is not a name is refused under this code too. -
TS8007LOOP_INFINITEExample - A loop that certainly never ends: a
while (true)or aforwith no condition, written or folded from constants, with nobreakorreturn, or aforwith constant bounds whose step does not move the counter toward its bound. -
TS8008LOOP_INDUCTIONExample - A
for...ofloop that does not declare one element, asfor (const x of xs)orfor (let x of xs)does. -
TS8009BREAK_OUTSIDEExample - A
breakwith no loop orswitcharound it. -
TS8017SWITCH_CASEExample - An invalid
switchcase: a label that is not an integer constant, does not fit the selector or repeats another; an empty clause with no body below it to share; a body whose end is reachable above a clause with a body, which TypeScript runs on into and WGSL does not (Rule 7.3); or acontinuein a switch that no loop encloses. -
TS8034BARRIER_PLACEMENTExample workgroupBarrier()orstorageBarrier()where a barrier cannot stand: in a vertex or fragment entry, which has no workgroup, or as a value, since a barrier is a statement. A barrier under control flow that the invocations do not share isUNIFORMITY.-
TS8052UNIFORMITYExample - A barrier, a
workgroupUniformLoad, or a derivative or implicit-LOD sample that the compiler's rewrite cannot reach, reached under a condition on a non-uniform value, or after areturn,breakorcontinuetaken under one (Rule 8.5). The message names the value as the author wrote it and the statement.
Entry points and IO
-
TS8024BUILTIN_NAMEExample - A
@builtin("...")with a malformed name argument, or with an id outside WGSL's builtin vocabulary. -
TS8025BUILTIN_STAGEExample - A
@builtin(...)id used as the input or output of the wrong stage, for examplefrag_depthon a vertex return orfront_facingon a vertex parameter. -
TS8026WORKGROUP_SHAPEExample - A warning:
@compute([x, y, z])exceeds one of WebGPU's default compute limits (256 forxandy, 64 forz, 256 invocations in all), so a device requested without a raised limit refuses the pipeline. -
TS8028ATTRIBUTE_NAMEExample - A decorator or an entry form that this surface does not read: an identifier outside the attribute vocabulary (
@vertex,@fragment,@compute,@builtin,@location), such as a misspelled@vertx; a WGSL attribute that the surface writes another way or does not borrow, such as a written@diagnostic(…); a stage written as a call, such asvertex(f); an entry that is written in a form that Rule 8.1 refuses, such asexport default; or a decorator on a declaration or in a place that takes none (Rule 6.7). Without this code the decorated function or field would silently stop being an entry point or an I/O field. -
TS8029STRUCT_FIELD_MISSING_ATTRExample - A user-defined input of a compute entry: a parameter, or a field of its struct, that carries no
builtin<…>. A compute entry has no user-defined input in WGSL, so the front end refuses it. On a vertex or fragment entry a value with no attribute is user-defined, and the compiler gives it its location (Rule 6.6). -
TS8037WORKGROUP_ARGExample @compute(...)with an argument that is not an array literal of one to three whole numbers: an object, a bare number, an identifier, or an empty or four-wide array. The check of the default limits isWORKGROUP_SHAPE.
Resources and memory
-
TS8032UNSIZED_ARRAY_LENGTHExample .lengthon anarray<T>with no size that is not in storage: auniform<array<T>>, a local or a parameter. A runtime-sized storage array reads its length from the buffer. Any other array needs an explicit size.-
TS8033MODULE_VARExample - A module variable declared or used where its address space forbids it: a
constwith an address-space wrapper, aworkgroupvariable with an initializer, a type that the space cannot hold (a texture, a runtime-sized array, an atomic in a per-invocation variable), an initializer that is not a constant, or aworkgroupvariable reached from a vertex or fragment entry. Also the retiredperInvocation<T>wrapper, which a plain top-levelletreplaced. -
TS8041TEXTURE_ARGUMENTExample - A plain argument of a texture read that the target has no overload for: a coordinate or gradient of the wrong width for the texture's dimension or of an element kind that the read does not take, a layer, mip level or sample index that is not a whole number of 0 or more, or a
level,biasordepth_refthat is not anf32. A texture that is wrong for the call, such as a sampled texture handed totextureStore, isTYPE_MISMATCH. -
TS8051LAYOUTExample - A buffer binding's store type that breaks one of WGSL's host-shareable rules: a
bool, alone or in a vector, in auniformorstoragebinding; a runtime-sizedarray<T>that is not the last member of its struct; a runtime-sized array in a uniform; or a two-row matrix (mat2x2,mat3x2,mat4x2) in a uniform, which WGSL and std140 lay out at different offsets (Rule 4.8). -
TS8079HOST_RESERVED_FIELDExample - A field of the class of an exported binding that is named like a member of its host accessor (Rule 6.1):
seton the class of an exporteduniform<T>or of the element of an exported storage array, andneedsUpdateordisposeon the class of an exporteduniform<T>. The host sets a field through its accessor (camera.pos.set(…)), so a field of the accessor's own name cannot be reached.
Emulated double
-
TS8027MAT_UNSUPPORTEDExample - A non-square
matCxR<f64>: the fp64 pass carries one double-float body for each dimension, so only a square matrix of doubles lowers. EverymatCxR<f32>is a type. -
TS8038F64_ENTRY_IOExample - An emulated double (
f64or avec64) on an entry's IO boundary: a@locationparameter, a@locationfield of an IO struct or an entry's return. A double is a pair off32words after lowering, and a varying interpolates each word on its own. Narrow withf32(x), or read the double in the stage that needs it, since a uniform or a storage binding carries anf64.
Targets
-
TS8015BACKENDExample - A backend that refused to emit a module the front end accepted. The message is the backend's own.
Retired numbers
-
TS8011 - Retired codes.
-
TS8012 - Retired codes.
-
TS8053 - Retired by change 0134 (INT_LITERAL_DEPRECATION): the warning of the window of, an undecided integer-written declaration "types as
f32today; it will type asi32". -
TS8078 - Retired by change 0131 (numerics): TS8078 was the refused numerical contract of change 0107; change 0131 removed the construct and retired the code.
-
TS8080 - Retired by change 0142 (VALUE_ARRAY_WRITE_LOST): TS8080 was the refused write to an array parameter that no
returncarries back (change 0138, Amendment A15); change 0142 makes an array parameter the caller's object, so such a write is the program's meaning and no refusal has a true text.
Other codes
-
TS8069MISPLACED_DIRECTIVEExample - A
"use typeshade"directive after another top-level statement (Rule 3.1). In ECMAScript a directive is only a leading string statement, so TypeScript reads a late one as an ordinary string. The fix is to move the directive, not to add one; a file with no directive at all isMISSING_DIRECTIVE. -
TS8070KERNEL_LOOP_ON_CPU - A warning on a loop of a kernel function (Rule 8.22) that the independence proof refused: the loop runs on the CPU. The message names the line and the names that stop it, and the remedy. The program is correct either way.
-
TS8071CONSOLE_NOT_RECORDEDExample - A warning under
compile(src, { console: 'gpu' }): aconsolecall that the WGSL does not record. The message gives the reason: a vertex entry reaches the call, an argument has no fixed size or is not a value, or the stage has no room for another storage buffer. The call still reaches the sink on the CPU (Rule 11.9). -
TS8073REFERENCE - A reference form that is not supported yet (Rule 8.8, change 0142):
@inoutor@out, which are removed because an object parameter is the caller's object with no mark, and a call that may give back an object that has a name. The message names the edit. -
TS8074REFERENCE_ALIAS - Two names for one object in one call, where a write reaches one of them:
f(a, a)wherefwrites one of the two, or a module variable passed to a function that also uses its name. The message says that the form is not supported yet (change 0142). -
TS8077KERNEL_WORKGROUP_REDUCESExample - A kernel function with
@workgroup_sizethat has a loop which reduces (Rule 8.22). A reduction always runs in the tree of 256, so an attribute that asks for another size cannot be honored. The message names the function and the remedy.
Core codes
The SDxxxx codes, from the CODES catalogue in typeshade/dev. The core IR layer raises them under the fn() builder and under a "use typeshade" file alike, and the front end refuses many of the same mistakes first under a code of its own.
Types and names
-
SD0001 - matrix × vector size mismatch
-
SD0002 - binary op on mismatched vectors
-
SD0003 - arithmetic op on a bool operand
-
SD0004 - binary op on incompatible types
-
SD0005 - bitwise op requires a
u32/i32left operand -
SD0006 - component access on a non-vector
-
SD0007 - vector component out of range
-
SD0008 - swizzle on a non-vector
-
SD0009 - .select() on a non-bool condition
-
SD0010 - select branches have differing types
-
SD0011 - matchExpr case type does not match the default
-
SD0015 - array-texture layer must be an integer
-
SD0116 - a scalar cast applied to a non-scalar value
-
SD0117 - a one-argument .at(i) on a node that is not an array
Builder calls
-
SD0012 - statement sink not installed
-
SD0013 - no active builder
-
SD0113 - a fn whose body returns nothing at the TypeScript level returns a value at run time
-
SD0115 - a branch body returned a value, which a branch cannot carry out
Resources and memory
-
SD0014 - override (specialization constant) must be a WGSL scalar type
-
SD0016 - host-owned resource has a shape the target cannot spell
-
SD0114 - a variable a function reads has no declaration in the module
Targets
-
SD0017 - literal cannot be spelled by the target
-
SD0020 - module validation failed
-
SD0030Example - unsupported feature for this backend
Emulated double
-
SD0040 f64type leaked past fp64Lower into a backend emitter-
SD0041 - unsupported operation on
f64operands -
SD0042 - conflicting fp64 guard declaration
-
SD0043Example - reserved fp64 name
-
SD0044 f64in an interpolated@locationIO field
Lint rules
-
SD0107 - assignment to an immutable 'let' binding
-
SD0108Example - smoothstep with constant edge0 >= edge1 (undefined in GLSL ES)
-
SD0109 - a fragment-only builtin is reachable from a vertex or compute entry
-
SD0112 - a local name is declared twice in one function
Portable kernels
Other codes
-
SD0118 - grad cannot differentiate this function
Numbering
The front end's registry records each gap in its numbering, with the reason:
TS8011 to TS8012: Retired codes. TS8012 was HOST_API, a list of JavaScript globals refused by their spelling; a name nothing declares is UNKNOWN_NAME, UNKNOWN_FN or UNKNOWN_TYPE by its position, and one the file declares is the file's (Rule 2.1). A gap is never reused.
TS8039 to TS8040: Unspent block of #162: while several sessions worked the issue list in parallel, each drew from a block of codes so that two branches in flight could not claim one number twice; F64_ENTRY_IO (TS8038) is the last code of the sequential range, and a block's unused codes (TS8039 to TS8067) stay unspent.
TS8042 to TS8049: Unspent block of #162 (TS8039 to TS8067); TEXTURE_ARGUMENT (TS8041) and RESERVED_NAME (TS8068) were assigned from blocks.
TS8053: Retired by change 0134 (INT_LITERAL_DEPRECATION): the warning of the window of #148, an undecided integer-written declaration "types as f32 today; it will type as i32". Change 0134 infers a number's type from its uses and keeps no default for an author to learn, so the warning has no true text.
TS8054 to TS8067: Unspent block of #162 (TS8039 to TS8067); a block's unused codes stay unspent.
TS8076: Reserved by draft proposal 0052 (not on main), changes/0067-kernel-workgroup-size.md (decision D7) and changes/0107-numerical-contract.md; it stays unused while that draft is open.
TS8078: Retired by change 0131 (numerics): TS8078 was the refused numerical contract of change 0107; change 0131 removed the construct and retired the code.
TS8080: Retired by change 0142 (VALUE_ARRAY_WRITE_LOST): TS8080 was the refused write to an array parameter that no return carries back (change 0138, Amendment A15); change 0142 makes an array parameter the caller's object, so such a write is the program's meaning and no refusal has a true text.