KUKA Robot codes
KUKA RobotSystemBasic

KRC0954

KUKA Robot KRC0954 - CONSTANT EXPECTED 2291

CONSTANT EXPECTED 2291

This alarm indicates that a constant value was expected during KRL program compilation or interpretation, but a variable or non-constant expression was provided instead. The compiler encountered a context where only a compile-time constant is permitted, such as in array dimension declarations, case labels, or other constant-only syntax contexts.

Common Causes

  • Using a variable instead of a literal constant in array dimension declaration
  • Attempting to use a non-constant expression in a switch/case statement label
  • Providing a variable reference where a compile-time constant is required in a data structure definition
  • Using an uninitialized or dynamically assigned value in a context requiring constant initialization
  • Referencing a parameter or local variable in a position that requires a constant value at compile time

Troubleshooting Steps

  1. 1Review the line number indicated in the alarm message and identify the statement causing the error
  2. 2Verify that all array dimensions use literal numeric constants (e.g., INT myArray[10] not INT myArray[size])
  3. 3Check case labels in switch statements to ensure they use only constant expressions, not variables
  4. 4Replace variable references with their constant values in contexts requiring compile-time constants
  5. 5Declare and initialize constants using CONST keyword for values that must be constant throughout the program
  6. 6Consult the KRL reference documentation for the specific syntax rule being violated and refactor the code accordingly

Seeing Multiple Alarms?

Seeing another alarm with this one? Enter the code.

Get machine-aware diagnosis

AxisMD logs alarms against your actual machines, tracks patterns, and gives AI context your manual doesn't have.

Start free

Was this guide helpful?

Always verify with your machine manual or a certified technician before performing service procedures.