LaserCanvas

GRBL alarm and error codes explained

An alarm means GRBL no longer trusts the machine position and has stopped everything — clear it with $X (unlock) or, better, $H (re-home). An error means GRBL rejected one line of G-code and carried on; the job is usually already ruined but the machine is fine. ALARM:1 is a hard limit hit, ALARM:2 is a job larger than the machine, and ALARM:9 is a homing switch that was never found.

Updated 2026-09-15

Alarms and errors are not the same thing

This distinction causes more confusion than the codes themselves, and it is worth getting straight before looking anything up.

AlarmError
What it meansGRBL has entered a locked state and does not trust its positionGRBL rejected one line and moved on
MotionEverything stops. No further motion is acceptedContinues with the next line
Clearing it$X to unlock, or $H to homeNothing to clear — fix the file
Your jobStopped where it stoppedUsually already wrong, because a line was skipped

The alarm codes

GRBL 1.1 defines nine. Four of them are about homing and two are about probing, which on a laser you will mostly meet through a Z-touch accessory.

CodeGRBL meansOn a laser, this usually is
ALARM:1Hard limit triggered. Position is lostThe head physically reached a limit switch. Either the job was placed off the bed, or the switch is noisy. Re-home.
ALARM:2G-code motion target exceeds machine travelThe job is bigger than the machine, or the work origin is set so the job runs off the edge. Position is safe — $X and reposition.
ALARM:3Reset while in motion. Position is lostSomething reset the controller mid-job: a soft reset, a USB dropout, or a brownout. Re-home and look at power and cabling.
ALARM:4Probe fail — probe not in expected initial stateThe probe input is already triggered. Usually a wiring short or an inverted probe pin.
ALARM:5Probe fail — no contact within programmed travelThe probe never touched. Check the clip, the plate and the travel distance.
ALARM:6Homing fail — reset during homingSomething reset the board mid-home. Same causes as ALARM:3.
ALARM:7Homing fail — safety door opened during homingA door interlock opened, or $41/door-pin configuration is wrong on a machine with no door.
ALARM:8Homing fail — could not clear the limit switch on pull-offThe switch stays triggered after backing off. Increase the pull-off distance ($27), or the switch is stuck or miswired.
ALARM:9Homing fail — limit switch not found within the search distanceThe most common homing failure. The axis moved the wrong way, the switch is dead, or $130–$132 max travel is set too small.

The error codes you will actually see

GRBL 1.1 defines thirty-eight errors. Most are G-code syntax problems that only appear if you are writing G-code by hand or using a broken post-processor. These are the ones that come up with real laser jobs.

CodeGRBL meansWhat to do
error:1A G-code word had a letter but no valueMalformed file. Regenerate it rather than patching it.
error:2Bad numeric valueOften a locale problem — a comma used as a decimal separator.
error:3Unrecognised $ system commandYou sent a setting this firmware does not have. Check the firmware version with $I.
error:5Homing is not enabled in settings$22=1 to enable homing, once you actually have switches.
error:8$ command needs GRBL to be idleStop the job before changing settings.
error:9G-code locked out during alarm or jogYou are in an alarm state. Clear it first — that is the real problem.
error:10Soft limits need homing enabledEither enable homing ($22=1) or turn soft limits off ($20=0). They only make sense together.
error:15Jog target exceeds machine travelHarmless. The jog was refused because it would leave the bed.
error:17Laser mode requires PWM output$32=1 was set on a board whose spindle pin cannot do PWM.
error:20Unsupported or invalid G-code commandUsually a post-processor emitting something GRBL does not implement, such as a canned cycle.
error:22Feed rate has not been setA G1 move with no F before it. A file generation bug.
error:24Two commands both needing XYZ words in one blockHand-edited G-code, almost always.
error:33Invalid motion targetAn arc that cannot be traced, or a probe target equal to the current position.

Anything not on this list is almost certainly a file generation problem rather than a machine problem. The relevant question is what produced the G-code, not what your machine settings are.

Is my machine actually GRBL?

Send $I. GRBL answers with its version and build. Three families share this command set and mostly share these codes:

Marlin and Smoothieware are different firmware with different messages entirely. If your machine answers $I with something that is not a GRBL version string, none of the numbers on this page apply.

Reading the status line

Sending ? at any time returns a one-line status report, and it answers most alarm questions faster than any lookup table.

A checklist for a machine that alarms on every home

  1. Send ? and read Pn:. If a limit letter is already listed, the switch is stuck, miswired or inverted ($5).
  2. Press each switch by hand and re-send ?. The letter should appear only while pressed.
  3. Check $23 — the homing direction mask. An axis homing away from its switch gives ALARM:9 every time.
  4. Check $27 — the pull-off distance. Too small and you get ALARM:8.
  5. Check $130, $131, $132 — max travel. Homing searches 1.5× this distance; set it too small and the switch is never reached.
  6. Only after that, consider noise. Unshielded limit wiring running alongside stepper cables causes intermittent ALARM:1 mid-job, and it will look random.

Common questions

What is the difference between $X and $H?

$X unlocks the alarm state without changing what GRBL believes about position. $H runs a homing cycle and re-establishes position against the switches. After ALARM:1 or ALARM:3 the position is genuinely unknown, so $H is the correct response; $X is for jogging off a switch before homing.

Why do I get ALARM:2 when my design clearly fits on the bed?

Because ALARM:2 is about machine travel from the current origin, not about the bed. If the work origin is set near one edge, a job that fits the bed can still run off the end of the travel. Re-home, set the origin, and check the job bounds from there.

My machine alarms randomly in the middle of long jobs. Which code is that?

Usually ALARM:1 or ALARM:3. Both are consistent with electrical noise rather than a real fault: unshielded limit switch wiring, a bad USB cable, or a supply that sags when the laser fires. Try a different USB cable and route limit wiring away from stepper and laser cables before changing any settings.

Do these codes apply to FluidNC?

The alarm numbers do — FluidNC reports the same set. The remedies that reference $ settings often do not, because FluidNC is configured through a YAML file. Look up the equivalent key in your config rather than sending $130=.

Can I just disable alarms so they stop interrupting?

You can turn off hard limits ($21=0) and soft limits ($20=0), and people do. It removes the message, not the condition — the head still hits the end of its travel, it just does so without stopping. On a machine with a laser in it, that is the wrong trade.

Written by a human with AI assistance and reviewed before publication. Mistakes are still possible — treat settings as starting points and test on scrap.