Guide
Grbl alarm and error codes, explained
Grbl reports problems as a number: ALARM:2 or error:20. Alarms stop the machine and lock it until you clear them. Errors reject one line of G-code. Here's every code from Grbl 1.1, what it means, and what to do about the ones hobby CNC owners hit most.
Updated November 25, 2026.
The ones you'll see most
- ALARM:1, hard limit: a limit switch was triggered mid-job. Position is lost, so re-home with
$H. - ALARM:2, soft limit: the file asks the machine to go past its travel, usually because work zero is set too close to an edge. Clear with
$Xand fix the zero. - ALARM:9, homing fail: a limit switch wasn't found. Check the switch and its wiring.
- error:9: you sent G-code while Grbl is in alarm. Clear the alarm first.
- error:20: the file has a command Grbl doesn't support, often an
M6tool change or code posted for a different controller. - error:22: a cutting move came before any feed rate (
F) was set.
How to clear a Grbl alarm
- Find out why it happened first. Unlocking without fixing the cause usually brings the alarm straight back.
- Send
$Xto unlock, or$Hto home. After a hard limit (ALARM:1) or a reset during motion (ALARM:3), always home again, because the machine may have lost its position. - Re-check your work zero before restarting the job.
Grbl alarm codes
| Alarm | Grbl 1.0 message | What it means | What to do |
|---|---|---|---|
| 1 | Hard limit | Hard limit has been triggered. Machine position is likely lost due to sudden halt. Re-homing is highly recommended. | A limit switch was hit (or tripped by electrical noise). Re-home before running again; if no switch was hit, check wiring and shielding. |
| 2 | Soft limit | Soft limit alarm. G-code motion target exceeds machine travel. Machine position retained. Alarm may be safely unlocked. | The job asks the machine to go past its travel. Usually the work zero (X0 Y0 Z0) is set so part of the job falls off the table, or the safe height is above the top of Z travel. Unlock with $X, then fix the zero or the file. |
| 3 | Abort during cycle | Reset while in motion. Machine position is likely lost due to sudden halt. Re-homing is highly recommended. | Reset while moving. Re-home: the machine may have lost steps. |
| 4 | Probe fail | Probe fail. Probe is not in the expected initial state before starting probe cycle when G38.2 and G38.3 is not triggered and G38.4 and G38.5 is triggered. | |
| 5 | Probe fail | Probe fail. Probe did not contact the workpiece within the programmed travel for G38.2 and G38.4. | |
| 6 | Homing fail | Homing fail. The active homing cycle was reset. | Homing was interrupted by a reset. |
| 7 | Homing fail | Homing fail. Safety door was opened during homing cycle. | |
| 8 | Homing fail | Homing fail. Pull off travel failed to clear limit switch. Try increasing pull-off setting or check wiring. | The switch stayed pressed after homing backed off. Increase pull-off ($27) or check the switch. |
| 9 | Homing fail | Homing fail. Could not find limit switch within search distances. Try increasing max travel, decreasing pull-off distance, or check wiring. | A switch wasn't found. Check the switch and wiring, and that max travel ($130-$132) is long enough. |
| 10 | Homing fail | Homing fail. Second dual axis limit switch failed to trigger within configured search distance after first. Try increasing trigger fail distance or check wiring. |
Grbl error codes
Errors don't lock the machine. Grbl skips the line it can't run and replies with the code, which most senders show in the console next to the line.
| Error | Grbl 1.0 message | What it means | What to do |
|---|---|---|---|
| 1 | Expected command letter | G-code words consist of a letter and a value. Letter was not found. | |
| 2 | Bad number format | Missing the expected G-code word value or numeric value format is not valid. | A number is badly formatted, for example a comma used as a decimal point. |
| 3 | Invalid statement | Grbl '$' system command was not recognized or supported. | |
| 4 | Value < 0 | Negative value received for an expected positive value. | |
| 5 | Setting disabled | Homing cycle failure. Homing is not enabled via settings. | |
| 6 | Value < 3 usec | Minimum step pulse time must be greater than 3usec. | |
| 7 | EEPROM read fail. Using defaults | An EEPROM read failed. Auto-restoring affected EEPROM to default values. | |
| 8 | Not idle | Grbl '$' command cannot be used unless Grbl is IDLE. Ensures smooth operation during a job. | |
| 9 | G-code lock | G-code commands are locked out during alarm or jog state. | Grbl is in alarm or jog state. Clear the alarm first ($X or home with $H). |
| 10 | Homing not enabled | Soft limits cannot be enabled without homing also enabled. | |
| 11 | Line overflow | Max characters per line exceeded. Received command line was not executed. | A line is too long for Grbl. Shorten comments or re-post the file. |
| 12 | Step rate > 30kHz | Grbl '$' setting value cause the step rate to exceed the maximum supported. | |
| 13 | Check Door | Safety door detected as opened and door state initiated. | |
| 14 | Line length exceeded | Build info or startup line exceeded EEPROM line length limit. Line not stored. | |
| 15 | Travel exceeded | Jog target exceeds machine travel. Jog command has been ignored. | A jog would go past the machine's travel. Jog the other way or re-home. |
| 16 | Invalid jog command | Jog command has no '=' or contains prohibited g-code. | |
| 17 | Setting disabled | Laser mode requires PWM output. | |
| 20 | Unsupported command | Unsupported or invalid g-code command found in block. | The file has a command Grbl doesn't support, such as an M6 tool change or a G-code made for another controller. Re-post the file for Grbl. |
| 21 | Modal group violation | More than one g-code command from same modal group found in block. | |
| 22 | Undefined feed rate | Feed rate has not yet been set or is undefined. | A cutting move came before any F feed rate. Re-post the file, or add an F value before the first G1. |
| 23 | Invalid gcode ID:23 | G-code command in block requires an integer value. | |
| 24 | Invalid gcode ID:24 | More than one g-code command that requires axis words found in block. | |
| 25 | Invalid gcode ID:25 | Repeated g-code word found in block. | |
| 26 | Invalid gcode ID:26 | No axis words found in block for g-code command or current modal state which requires them. | |
| 27 | Invalid gcode ID:27 | Line number value is invalid. | |
| 28 | Invalid gcode ID:28 | G-code command is missing a required value word. | |
| 29 | Invalid gcode ID:29 | G59.x work coordinate systems are not supported. | |
| 30 | Invalid gcode ID:30 | G53 only allowed with G0 and G1 motion modes. | |
| 31 | Invalid gcode ID:31 | Axis words found in block when no command or current modal state uses them. | |
| 32 | Invalid gcode ID:32 | G2 and G3 arcs require at least one in-plane axis word. | |
| 33 | Invalid gcode ID:33 | Motion command target is invalid. | A move target is invalid, often an arc that doesn't close. Re-post with a Grbl post processor. |
| 34 | Invalid gcode ID:34 | Arc radius value is invalid. | |
| 35 | Invalid gcode ID:35 | G2 and G3 arcs require at least one in-plane offset word. | |
| 36 | Invalid gcode ID:36 | Unused value words found in block. | |
| 37 | Invalid gcode ID:37 | G43.1 dynamic tool length offset is not assigned to configured tool length axis. | |
| 38 | Invalid gcode ID:38 | Tool number greater than max supported value. |
Codes and descriptions from the official Grbl 1.1 documentation (gnea/grbl). Forks such as grblHAL and FluidNC add more codes.
Stop errors before they start
Most G-code errors come from a file written for a different controller: Mach3 commands such as G64 or M6 tool changes, or comments Grbl can't parse. Use a post processor made for Grbl. Cutline Studio has separate Grbl and Mach3/Mach4 outputs: the Grbl output leaves out commands Grbl rejects, and every file keeps its comments free of nested brackets.
Soft-limit alarms (ALARM:2) are usually a setup problem rather than a file problem. Check that your work zero leaves the whole job, plus the bit, inside the machine's travel, and that the file's safe height fits under the top of the Z axis.
If you run a Grbl, grblHAL or FluidNC machine from Cutline Control (beta, the Machine tab in Cutline Studio 1.1), it checks the job before the bit moves: it warns when the job is bigger than your machine, which catches one common cause of ALARM:2, and it finds G-code lines your controller can't run, the usual cause of error:20. When an alarm does come up, there's help at the machine to explain it. See Grbl senders and CAM for the other senders that work with Grbl.
More guides: CAM for Grbl and Mach3 · G-code generator · CNC software for beginners · feeds and speeds for plywood · all guides
FAQ
What does ALARM:2 mean in Grbl?
How do I unlock Grbl after an alarm?
What causes error:20 in Grbl?
What is error:22?
Try Cutline Studio
Design one project free in your browser, or download the 7-day free trial for Windows 10 and 11.