For the complete documentation index, see llms.txt. This page is also available as Markdown.

Semantic errors (GPC40xx)

GPC4000 — Redefinition

Redefinition of {kind} '{name}' detected (previously declared on {location})
Duplicate parameter name '{name}' in function '{function}'

Severity: Error

The same name is declared twice as the same kind of symbol — two variables, two functions, two defines with the same name, or two parameters of one function. The message points at the earlier declaration.


GPC4001 — Naming Conflict

'{name}' is already declared on {location}
Function '{name}' conflicts with built-in function '{name}'
{Kind} '{name}' conflicts with {other kind} '{name}' declared on {location}

Severity: Error

The same name is used where the compiler requires uniqueness. Variables, definitions, enum members, and const-data names share the data-symbol namespace, so a define and variable cannot reuse one name. Function names and combo names are resolved separately from that namespace, while built-in names and language keywords remain reserved. A user function named after almost any built-in (set_val, get_val, ...) also triggers this diagnostic; only min, max, and clamp get special handling instead (see GPC4025).


GPC4002 — Undefined Identifier

'{name}' is not defined
Undefined variable: {name}
No variable or const array named '{name}' could be found.

The first may carry the suggestion Did you mean '{other}'?.

Severity: Error

An identifier is referenced but no variable, define, enum member, const array, function parameter, or built-in constant with that name exists. Check spelling and case — GPC names are case-sensitive; the compiler suggests the closest existing name when one is similar enough.


GPC4003 — Scoped Variable Not Supported

Severity: Error

A variable is declared inside a block (function body, main, if body, ...). GPC has no block scope — all variables must be declared at the top level of the script.


GPC4004 — Function Used as Value

Severity: Error

Either a function name is used where a value is expected (e.g. x = myFunc; without parentheses), or the inverse: a value symbol (variable, define, ...) is called like a function (myVar()).


GPC4005 — Invalid Control Flow

Severity: Error

A control-flow statement appears in a context where it has no meaning. Note that continue is not allowed inside a switch unless the switch itself is inside a loop, and return is only valid inside a user-defined function body.


GPC4006 — Invalid Array Access

Severity: Error

Two-dimensional index syntax (name[a][b]) is applied to something that is not a 2D const array. Only const arrays declared with two bracket pairs support two indexes.


GPC4007 — Invalid Assignment Target

Severity: Error

The left side of an assignment (or the operand of ++/--) is not something writable: it is a literal, an expression, a define, an enum member, a const array, or a built-in constant. Only variables and array-slot accesses can be assigned.


GPC4009 — Invalid Function Parameter

Severity: Error

The argument to a combo keyword (combo_run, combo_stop, combo_pause, combo_running, ...) is not the name of a declared combo — it is a variable, function, define, or a computed expression. Combo references are resolved at compile time and must be plain combo names.


GPC4010 — Invalid Combo Usage

Severity: Error

A combo name or combo-only keyword is used in the wrong place. Combos are not values and not functions; combo-only keywords such as wait() and call() may only appear directly at the root level of a combo body — not in main, and not nested inside an if/while/for within the combo.


GPC4011 — Too Many Arguments

Severity: Error

A call passes more arguments than the function declares.


GPC4012 — Too Many Parameters

Severity: Error

A function declaration has more parameters than the compiler accepts.


GPC4013 — Variable Declared in for Initializer

Severity: Error

A for loop header declares a variable in its initializer clause (for(int i = 0; ...)). GPC has no block scope — declare the counter at top level and only assign it in the header.


GPC4014 — for Initializer Shadows a Global

Severity: Error

The name used in a for initializer collides with an existing global variable, definition, enum member, const array, or built-in constant.


GPC4015 — Recursive Combo Call

Severity: Error

A combo body uses call({name}) on itself. Combos are state machines that each advance one step at the end of every main loop iteration; call() doesn't hand execution off to the other combo and move on — it pauses the calling combo's state machine until the called combo finishes running, then resumes where it left off. A combo calling itself would have to finish before it can finish, which can never happen, so the compiler rejects it outright. (Using combo_run on itself is merely useless — see GPC3008 — since combo_run starts a combo rather than pausing to wait for one.)


GPC4016 — Mutual Combo Recursion

Severity: Error

Two or more combos call() each other in a cycle (for example, A calls B and B calls A). Because call() pauses the calling combo's state machine until the called combo finishes, every combo in a cycle ends up waiting on another combo in that same cycle to finish first — none of them can ever complete. The message spells out the detected chain; break the cycle by restructuring so at least one combo in the chain no longer waits on a combo that, directly or indirectly, waits on it in return.


GPC4017 — Empty Const Array

Severity: Error

A const array (or one row of a 2D const array) is declared with zero values. The array's size comes from its initializer, so an empty initializer is meaningless.


GPC4018 — Invalid Const Array Structure

Severity: Error

The rows of a 2D const array have different lengths. Every row must contain the same number of values as the first row.


GPC4019 — Invalid PS5ADT Data

Severity: Error

A const ps5adt entry does not contain exactly the 11 values the PS5 adaptive-trigger format requires.


GPC4020 — Const Array Negative Index

Severity: Error

A const array is indexed with a compile-time-constant negative value.


GPC4021 — Const Array Index Out of Bounds

Severity: Error

A const array is indexed with a compile-time constant that is >= the array's element count. Valid indexes are 0 through size - 1.


GPC4022 — Variable Slot Underflow

Severity: Error

Non-const variable arrays are laid out as consecutive variable slots, and a constant index is resolved at compile time. Here the index is negative enough that the access lands before the first allocated slot — it would silently read or clobber memory outside the array.


GPC4023 — Variable Slot Overflow

Severity: Error

Counterpart to GPC4022: a constant index on a variable array resolves past the end of all allocated variable slots.


GPC4025 — Built-in Function Conflict

Severity: Error

A user-defined function is named after a pattern-detectable built-in (min, max, clamp) but its body does not implement the built-in's semantics. Because calls to these names bind to the built-in, keeping a different implementation would silently change behavior — rename the function.

This behavior check is special-cased to only min, max, and clamp. Naming a function after any other built-in (set_val, get_val, ...) is always a plain naming conflict — reported as GPC4001 — no matter what the function's body does.


GPC4026 — Never-Ending do-while

Severity: Error

A do { ... } while (condition); whose condition is constant-true and whose body contains no break or return. On the Zen a script must yield back to the runtime every iteration of main; an infinite inner loop would hang the device, so it is rejected outright.


GPC4027 — Never-Ending while

Severity: Error

Same as GPC4026 for while (1) { ... }-style loops with no exit.


GPC4028 — Never-Ending for

Severity: Error

Same as GPC4026 for for(;;)-style loops (empty or constant-true condition) with no exit.


GPC4029 — String Value in define

Severity: Error

A define is initialized with a string literal (e.g. define NAME = "text";). define values must be numeric compile-time constants.


GPC4030 — Invalid sizeof() Operand

Severity: Error

The operand of sizeof() is not a variable, an array access, or a type keyword.


GPC4031 — Const Array Single-Bracket 2D Access

Severity: Error

Single-bracket, value-context access to a two-dimensional const array (e.g. M[i] where M is declared const T M[][] = {...}). A 2D const array's element accessor takes a row and a column index — one bracket pair only supplies the row, so the access is rejected rather than silently reading an uninitialized column.

image, string, and ps5adt 2D arrays are exempt: they are row-addressed by design (a single bracket returns the row's base address, not a dereferenced row+column element), matching how the original Zen Studio compiler treats those two types. addr(M[row]) is a separate, unaffected code path for any element type.


GPC4032 — Conditional Used as a Statement

Severity: Error

A conditional expression is written as a bare statement instead of producing a value. The operator selects between two values; it is not a substitute for if/else.

Last updated