KUKA Robot codes
KUKA RobotProgram/G-codeAdvanced

KRC0495

KUKA Robot KRC0495 - PROGRAM STACK OVERFLOW

PROGRAM STACK OVERFLOW

This alarm indicates that the program execution has exceeded the maximum nesting depth allowed for subprogram and function calls on the KUKA KRC controller. The stack memory allocated for tracking nested subroutine calls has been exhausted, preventing further program execution. This typically occurs when programs contain excessive levels of function calls within functions or recursive calls without proper termination conditions.

Common Causes

  • Infinite or uncontrolled recursive function calls without proper base case or exit condition
  • Excessive nesting of subprogram calls (more than the controller's maximum allowed depth, typically 32-64 levels)
  • Circular call dependencies where Program A calls Program B which calls Program A
  • Poorly structured code with multiple layers of nested subprogram calls that could be consolidated
  • Memory corruption or stack pointer corruption from buffer overflows or invalid memory access

Troubleshooting Steps

  1. 1Stop program execution immediately and review the call stack trace in the diagnostic menu to identify which programs/functions are currently nested
  2. 2Check the main program and all called subprograms for recursive function calls and verify they have proper termination conditions
  3. 3Refactor deeply nested code by consolidating multiple levels of subprogram calls into fewer, more efficient functions
  4. 4Review function dependencies and call chains using the KUKA program analysis tools to eliminate circular references
  5. 5Increase available stack memory if possible through controller configuration settings, or simplify the program logic to reduce nesting depth
  6. 6Clear the program stack by powering off the controller, verifying the corrected program logic, and restarting the system

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.