> For the complete documentation index, see [llms.txt](https://guide.cronuszen.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.cronuszen.com/gpcscripting/gpc-script-guide/troubleshooting/compiler-diagnostic-catalog/compiler-errors-gpc51xx.md).

# Compiler errors (GPC51xx)

### GPC5100 — Unknown Opcode

```
Unknown opcode: {name}
No push immediate opcode available in configuration (expected pushi8, pushi16, pushi32, or pushi)
No allocation opcode available in configuration (expected alloc or alloc16)
```

**Severity:** Error

The compiler needs an instruction that the selected device does not provide. This indicates a problem with the toolchain or device profile, not with your script.

***

### GPC5102 — Data Not Constant

```
The constant '{name}' could not be computed at compile-time. All definitions must be possible to compute during compilation.
The enum value '{name}' could not be computed at compile-time. All enum values must be possible to compute during compilation.
Data section values must be constant expressions
The expression '{expr}' could not be computed at compile-time. All const array values must be possible to compute during compilation.
```

**Severity:** Error

A `define` value, enum member value, `data(...)` entry, or const array value contains something that cannot be evaluated at compile time — typically a reference to a variable or a function call. These contexts accept only literals and arithmetic over other compile-time constants.

```c
int limit;
define MAX = limit + 1;   // GPC5102 — 'limit' is a runtime variable
```

***

### GPC5103 — Array Size Not Constant

```
Array size must be a constant
```

**Severity:** Error

The size expression in a variable array declaration (`int arr[N];`) is not a compile-time constant. Use a literal, `define`, or enum member.

***

### GPC5104 — break Outside Loop

```
break statement outside of loop or switch
```

**Severity:** Error

Safety-net counterpart of GPC4005 for `break`; under normal circumstances the earlier check reports the problem first.

***

### GPC5105 — continue Outside Loop

```
continue statement outside of loop
```

**Severity:** Error

Safety-net counterpart of GPC4005 for `continue`.

***

### GPC5106 — Unsupported Literal Type

```
String literals are not supported in expression context
```

**Severity:** Error

A string literal (`"..."`) appears somewhere other than the two places GPC allows it: initializing a `const string` declaration, or as the operand of `addr()`. A bare `"..."` used directly as a function argument, in arithmetic, in an assignment, or anywhere else in an expression triggers this error.

Functions that take text (e.g. `print`'s string address parameter) don't accept a literal inline — they take the *address* of a declared `const string`. Declare the string first, then pass its name (or `addr(name)`):

```c
const string msg = "Hello";
main {
    print(1, 0, 0, msg, TEXT_LARGE);   // OK — msg is a const string, not a literal
    print(1, 0, 0, "Hello", TEXT_LARGE); // GPC5106 — bare literal in expression context
}
```

***

### GPC5108 — Unsupported Binary Operator

```
Unsupported binary operator
Unsupported binary operator for compound assignment
```

**Severity:** Error

Internal safety net for an operator the compiler cannot translate in this position; reaching it indicates a compiler bug, not a script error — report the script that triggers it.

***

### GPC5111 — Increment/Decrement Requires Variable

```
Increment/decrement requires a variable operand
```

**Severity:** Error

Safety-net counterpart of GPC4007 for `++`/`--` on a non-variable operand.

***

### GPC5112 — sizeof Unresolved

```
sizeof() expression could not be resolved at compile time
```

**Severity:** Error

`sizeof()` was applied to an operand whose size the compiler cannot determine — e.g. a 2D-indexed access on something that is not a 2D const array, or an arbitrary expression.

***

### GPC5113 — sizeof(keyword) Not Supported

```
sizeof({keyword}) is not supported
```

**Severity:** Error

`sizeof()` was applied to a keyword that has no supported fixed size on the selected target. On the current Zen target, the numeric forms `sizeof(int8)`, `sizeof(uint8)`, `sizeof(int16)`, `sizeof(uint16)`, and `sizeof(int32)` are supported. `sizeof` also works on variables, variable arrays, const arrays, and const array elements.

***

### GPC5114 — Immediate Value Out of Range

```
Value {value} is out of range for type '{type}' ({min}..{max})
Value {value} is out of range for 16-bit immediate (valid range: -32768 to 32767)
```

**Severity:** Error

A compile-time value does not fit its storage: a const array element outside its declared element type's range, or (in a 16-bit script) an immediate constant outside the 16-bit signed range.

```c
const int8 vals[] = { 100, 200 };   // GPC5114 — 200 > 127, use uint8
```

***

### GPC5116 — Invalid Image Data

```
Image data must have at least 3 values (width, height, pixels), found {count}
Image width {w} is out of range (1..{max})
Image height {h} is out of range (1..{max})
Image data has {count} values, expected {expected} (2 + ceil({w} * {h} / 8))
```

**Severity:** Error

A `const image` entry is malformed. The format is `width, height` followed by exactly `ceil(width * height / 8)` packed pixel bytes, with dimensions bounded by the device's OLED screen size.

***

### GPC5123 — Negative Array Size

```
Array size cannot be negative (got {size})
```

**Severity:** Error

A variable array is declared with a constant negative size, e.g. `int arr[-1];` or a define/enum that evaluates below zero.

***

### GPC5125 — Inconsistent Return

```
Function '{name}' has inconsistent return statements. Some return a value and some don't.
```

**Severity:** Error

Within one function, some `return` statements carry a value and others are bare `return;`. A GPC function either returns a value on every return path or on none of them.

***

### GPC5126 — addr() Requires Const Array

```
addr() only works with const arrays. '{name}' is a variable, not a const array.
addr() only works with const arrays. '{name}' is not a const array.
addr() only works with const arrays for 2D access
addr() only works with const arrays
```

**Severity:** Error

The operand of `addr()` is not a const array (or const-array element access). `addr()` yields the data-section address of const array contents; variables and other symbols have no such address.

***

### GPC5128 — Undefined Function

```
Function '{name}' is not defined
Undefined function: {name}
```

**Severity:** Error

A call names a function that is neither user-defined nor a built-in of the selected device. Check spelling, and check that the function exists on the target device/firmware.

***

### GPC5129 — Undefined Combo

```
Combo '{name}' is not defined. Make sure you've declared this combo before using it in {function}().
Unknown combo: {name}
```

**Severity:** Error

A combo keyword (`combo_run`, `combo_stop`, ...) references a combo name that is not declared anywhere in the script.

***

### GPC5130 — Invalid Argument Count

```
Function '{name}' expects {n} argument(s), but got {m}
Function '{name}' expects at least {n} argument(s), but got {m}
Function '{name}' expects at most {n} argument(s), but got {m}
Function '{name}()' requires a combo name as argument 1, but only 0 argument(s) were provided.
wait() requires exactly 1 argument, got {m}
'{name}' requires at least one argument
```

**Severity:** Error

A call passes the wrong number of arguments — user functions must be called with exactly their declared parameter count; each built-in has its own required minimum and maximum on the target device.

***

### GPC5131 — Invalid Argument Type

```
Argument {i} of '{name}' must be a compile-time constant
Argument {i} of '{name}' {requirement}
Combo keyword argument must be a combo name
'{name}' requires a variable or constant-index array element as first argument
'{name}' requires a compile-time constant as first argument
```

**Severity:** Error

An argument does not meet the parameter's declared requirement. Some built-in parameters accept only a compile-time constant from a fixed list — e.g. `ps4_touchpad`'s constant parameter only accepts one of the `PS4T_*` identifiers, not a variable or computed value. Others must be a plain declared variable — e.g. `set_bit`/`clear_bit`/`set_bits`'s variable parameter, since the function reads or writes that variable directly; a constant, enum member, or arbitrary expression there triggers this error (a constant-index array element is still fine).

***

### GPC5132 — Argument Out of Range

```
wait() duration {value} is outside valid range [{min}..{max}]
```

**Severity:** Error

A constant argument is outside the hard limits for the parameter — currently enforced for `wait()` durations in combos. (Range limits on other built-in arguments are reported as GPC5153 or GPC6010 instead.)

***

### GPC5133 — Combo Function Context

```
{keyword}() cannot be used in an expression context
{keyword}() return value is not used
wait() can only be used inside a combo
```

**Severity:** Error

A combo keyword is used in the wrong expression/statement position: statement keywords (`combo_run`, `combo_stop`, ...) produce no value and cannot appear inside expressions or conditions; expression keywords (`combo_running`, `combo_suspended`, `combo_current_step`, `combo_step_time_left`) produce a value that must be consumed; and `wait()` is only meaningful inside a combo body.

***

### GPC5134 — Function Has No Return Value

```
Function '{name}' does not return a value and cannot be used where a value is required
```

**Severity:** Error

A function whose body never returns a value is used in a condition, assignment, or argument. Either add `return <value>;` statements to the function or stop consuming its (nonexistent) result.

***

### GPC5135 — Unused Return Value

```
Return value of '{name}' is not used
```

**Severity:** Error

A *built-in* function that returns a value is called as a bare statement, discarding the result. Unlike most languages this is an error in GPC (for built-ins; user-function results may be discarded). Assign the result or use it in a condition.

***

### GPC5136 — Function Not Allowed in Loop

```
'{name}' cannot be called inside a loop
```

**Severity:** Error

This built-in must not be called from inside a loop body on the target device (its side effects must run at most once per `main` pass). Move the call out of the loop.

***

### GPC5137 — Function Minimum Level

```
'{name}' requires a minimum function nesting level of {level}
```

**Severity:** Error

This built-in may only be called from a sufficiently nested context — e.g. only from inside a user-defined function rather than directly in `main`.

***

### GPC5138 — Invalid Case Value

```
Case value must be an integer constant
Case value must be a compile-time constant
```

**Severity:** Error

A `case` label in a `switch` is not a compile-time integer constant. Use literals, defines, or enum members.

***

### GPC5139 — Duplicate Case Value

```
Duplicate case value '{value}'
Duplicate case value: {value}
```

**Severity:** Error

Two `case` labels in the same `switch` resolve to the same constant — remember that defines and enum members are resolved to their values first.

***

### GPC5140 — Duplicate Label

```
Duplicate label: {name}
```

**Severity:** Error

The compiler saw the same internal jump label defined twice. Internal error — not producible from script source directly; report the script that triggers it.

***

### GPC5141 — Undefined Label

```
Undefined label: {name}
```

**Severity:** Error

The compiler saw a jump to an internal label that was never defined. Internal error — not producible from script source directly; report the script that triggers it.

***

### GPC5142 — Internal Compiler Error

```
Internal error: {details}
```

For example: `Internal error: number literal token has no value`, `Internal error: current combo data not found`, `Unexpected block-level statement at top level`, `Failed to deserialize device configuration: {error}`.

**Severity:** Error

An invariant inside the compiler itself was violated. This is a compiler bug, not a script bug — report the script that triggers it.

***

### GPC5143 — Maximum Variables Exceeded

```
Array '{name}' requires {n} variable slot(s), exceeding the device's maximum of {max} variable slot(s) ({used} slot(s) already allocated)
```

**Severity:** Error

The script declares more variable storage than the device provides. Every scalar variable takes one slot and every variable array takes one slot per element; combos also reserve a few internal slots. Shrink arrays or move constant tables into `const` arrays (which live in the data section, not variable slots).

***

### GPC5144 — Maximum Bytecode Size Exceeded

```
Bytecode size ({size} bytes) exceeds maximum allowed ({max} bytes)
```

**Severity:** Error

The compiled output is larger than the device's bytecode limit. Reduce script size — factor repeated code into functions, shrink data tables, and let the optimizer remove unused code.

***

### GPC5145 — Expression Has No Effect

```
Expression has no effect
```

**Severity:** Error

A statement consists of an expression that neither assigns, calls, increments, nor otherwise does anything — its value is computed and thrown away. Almost always a typo, e.g. `==` where `=` was meant.

```c
main {
    speed == 100;   // GPC5145 — comparison result discarded; use '='
}
```

***

### GPC5153 — Builtin Argument Out of Range (Error)

```
Argument {i} of '{name}' is {value}, minimum is {min}
Argument {i} of '{name}' is {value}, maximum is {max}
Argument {i} of '{name}' has value {value} which is not in the allowed set
```

**Severity:** Error

A constant argument is outside the hard limit the target device sets for that built-in parameter. Same message templates as GPC6010 — whether a given built-in parameter's limit is a hard error (this code) or a recommendation (GPC6010) depends on the parameter and the target device, not on how you call it. (`wait()` durations in combos report GPC5132 instead.)

***

### GPC5154 — Zero-Size Array With No Alias Target

```
Zero-size array '{name}' has no following variable to alias -- any access would write past the allocated variable table
```

**Severity:** Error

A zero-size array declaration (`int arr[0];`) is, by itself, an accepted GPC quirk: it occupies no storage and its name aliases whatever variable is declared immediately after it (see GPC6031). This error is the invalid form of that quirk — the zero-size array is declared with nothing following it (or nothing eligible to alias), so its implied slot sits at or past the end of the allocated variable table. Any access through it would read or write past allocated memory. Declare a real variable after it, or remove the zero-size array.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://guide.cronuszen.com/gpcscripting/gpc-script-guide/troubleshooting/compiler-diagnostic-catalog/compiler-errors-gpc51xx.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
