FANUC codes
FANUCProgram/G-codeIntermediate15-30 minutes

125

Fanuc Alarm 125 - DO Loop Nesting Exceeded

Too Many DO Levels

Fanuc program alarm 125: Too Many DO Levels. The part program contains an error or illegal condition that the Fanuc control cannot execute. Correct the program to clear this alarm.

Root Cause Summary

Fanuc Alarm 125 MACRO STATEMENT FORMAT ERROR occurs when the CNC detects improper syntax or formatting within a custom macro program (G65/G66 macro call or macro body using #variables). This typically results from incorrect use of macro variable expressions, missing operators, invalid arithmetic statements, or improperly formatted conditional/assignment statements in the macro code.

Safety

  • Macro stopped

Causes and Fixes

  1. 1

    Review the macro program line indicated in the alarm display. Check PROGRAM screen for the O-number and sequence number where the alarm occurred. Look for the specific N-block or statement causing the error.

  2. 2

    Verify all macro variable assignment statements follow correct format: #i=expression (ensure space or proper operator exists between all variables and constants). Check for missing arithmetic operators (+, -, *, /, AND, OR, XOR) between operands.

  3. 3

    Confirm all parentheses and brackets are properly paired and nested in arithmetic expressions. Example: #100=[#101+#102]*SIN[#103] must have matching brackets.

  4. 4

    Check parameter 6001 (macro variable address display format) to verify macro executor is enabled. If set to 0, custom macro capability may be disabled causing format errors.

DIY Feasiblehigh confidence

Call a technician if:

  • ·Parameter corruption suspected
  • ·Macro memory allocation issues
  • ·Control software requires update

Prevention

  • Limit DO loop nesting to 2 levels maximum
  • Always pair DO statements with END statements
  • Use structured programming practices in macros
  • Test macros incrementally during development

Common Mistakes

  • Forgetting END statements when copying DO loops
  • Using system variables as loop counters
  • Nesting loops beyond 3 levels
  • Not initializing loop variables before DO statements

Related Alarms

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.