FANUC codes
FANUCProgram/G-codeIntermediate5-30 minutes

104

Fanuc 104 - Illegal variable number

ILLEGAL VARIABLE NUMBER

Fanuc PS program alarm 104: ILLEGAL VARIABLE NUMBER. This alarm is triggered by an illegal or incorrectly formatted command in the part program, or a programming condition that the Fanuc control cannot execute.

Root Cause Summary

Alarm 104 occurs when the CNC program references a macro variable number that is outside the valid range for the control, or uses an invalid format for variable addressing. This commonly happens with system variables, common variables (#100-#999), or when variable numbers are calculated incorrectly using indirect addressing.

Safety

  • Verify corrected program or parameters before resuming machining

Causes and Fixes

  1. 1

    Note the program line number where alarm occurred and review the O-number program on the CNC display or using EDIT mode.

  2. 2

    Identify all variable references (#xxx) on the alarm line and verify each number is within valid range: #1-#33 local, #100-#199 common saved, #500-#999 common, #1000-#9999 system variables per your control model.

  3. 3

    Check for indirect addressing like ##i where variable #i may calculate to zero, negative, or exceeds maximum. Insert a debug line before alarm to display calculated value: #3000=##i (displays on screen).

  4. 4

    Correct the variable number to valid range or fix the calculation logic. If using system variables, consult parameter manual section 4 for your specific control series (0i, 30i, 31i, etc.) to verify valid system variable ranges.

    System variable ranges differ between control models - using 31i variables on a 0i control will trigger this alarm

Service Recommended confidence

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.