โ† Open Viewer
โ† All Articles Coordinate Errors Printer Errors CNC Errors Arc Errors

Troubleshooting Common G-Code Errors and Machine Faults

Every machinist and 3D printer operator has been there: the program starts running, something looks wrong, and you hit the E-stop wondering what on earth happened. G-Code errors range from the harmless (a missing M30 at the end of a program) to the catastrophic (a Z-axis plunge into the workpiece at rapid speed). Knowing how to diagnose and fix them quickly is a core skill that separates experienced operators from beginners.

This guide covers the most common errors systematically โ€” for both CNC machining and 3D printing โ€” with clear causes and actionable fixes for each. Many of these errors can be caught before they happen by simulating your G-Code in GCodex before running it on the real machine.

Coordinate System Errors

โŒ Machine cuts in completely the wrong location
Cause: Wrong work coordinate system (WCS) active. The programmer used G54 but the machine has a different offset entered in G54, or G55 is active from a previous job.
Fix: Always check which WCS is active at program start. Ensure G54 (or your intended WCS) is explicitly called at the top of every program. Verify the offset values in the controller match your measured part datum. Add a safe Z retract before the G54 call to prevent accidental plunges if the WCS is wrong.
โŒ Machine moves to mirror-image or inverted positions
Cause: G90/G91 mode mismatch. The program switches to G91 (incremental) but a later absolute move isn't preceded by G90 to switch back. Or the program was written for a different machine with opposite axis orientation.
Fix: Always reset G90 at the start of every program. After any use of G91, explicitly write G90 to return to absolute mode. Visualize in GCodex to spot mirrored moves before they happen.
โŒ All cuts are at the wrong Z depth
Cause: Tool length offset not set correctly. The controller's tool length offset (H value) doesn't match the actual tool length, so all Z coordinates are shifted by the error amount.
Fix: Re-measure tool length with the tool setter or gauge block. Enter the correct value in the tool offset register. Always run a dry cycle (with Z raised 50mm above the workpiece) before the first real cut after a tool change.

Homing Failures

โŒ Machine doesn't reach end stop / skips homing
Cause (3D printer): Endstop wiring loose or trigger point misadjusted. Cause (CNC): Homing switch damaged, reference cam worn, or machine travel too short.
Fix: Manually trigger the endstop with a finger and watch the controller display โ€” if the axis status changes, the switch works and the problem is mechanical (cam position, wiring). Replace switch if no response. On Marlin, M119 reports current endstop states.
M119   ; Report endstop states
; Response:
; x_min: open
; y_min: TRIGGERED   โ† this axis switch is working
; z_min: open

Thermal Runaway (3D Printers)

โŒ "THERMAL RUNAWAY" error โ€” printer halts mid-print
Cause: The temperature sensor detects a temperature drop (or rise) that Marlin's thermal safety algorithm decides is abnormal โ€” indicating a failed heater, loose thermistor, or a draught affecting the hotend. This is a safety feature, not a bug โ€” it prevents fires.
Fix: Check thermistor wiring (loose connector at hotend is the most common cause). Check heater cartridge continuity. If the printer is in a draughty area, enclose it. Ensure THERMAL_PROTECTION_HOTEND parameters in Marlin match your actual heater's response time. Never disable thermal protection.

Extrusion Problems

โŒ Under-extrusion โ€” thin walls, gaps in infill, weak layers
Cause: E-steps (extruder steps-per-mm) incorrectly calibrated, partial clog in nozzle, bowden tube gap at hotend, or print temperature too low for the filament.
Fix: Calibrate E-steps: mark 100mm on filament, command G1 E100 F100 in terminal, measure how much was actually extruded. Adjust E-steps: M92 E_value, then M500 to save. If under-extrusion persists, perform cold pull to clear partial clogs.
; E-steps calibration commands:
M92 E415        ; Set extruder to 415 steps/mm (adjust to your value)
M500            ; Save to EEPROM
M503            ; Verify saved settings
โŒ Extruder clicking / grinding filament
Cause: Feed rate too high for hotend's melt capacity, temperature too low, partial clog, or bowden tube retraction too aggressive creating a plug.
Fix: Increase hotend temperature by 5โ€“10ยฐC. Reduce print speed in slicer. Check retraction: for direct drive, 0.5โ€“1.5mm is typical; for bowden, 4โ€“7mm. Values much higher than this can cause filament grinding on retractions.

Arc Radius Errors (CNC)

โŒ "ARC RADIUS MISMATCH" or "ILLEGAL RADIUS" alarm
Cause: In G2/G3 arc commands, the distance from the start point to the center (I, J) must equal the distance from the end point to the center. If there is a rounding discrepancy (due to floating point precision), some controllers throw this error.
Fix: Check the arc command โ€” verify I and J values calculate to the same radius from both start and end points. Some controllers have a tolerance setting (e.g., #3410 on Fanuc). Using R-format arcs instead of I/J avoids this issue entirely. Or increase the controller's arc-check tolerance parameter.
; Problematic arc (I/J format - may have precision error):
G2 X20 Y0 I-10 J0 F600

; Safer alternative (R format):
G2 X20 Y0 R10 F600

Tool Diameter Offset Errors (CNC)

โŒ Parts come out oversized or undersized on milled contours
Cause: Cutter compensation (G41/G42 โ€” left/right cutter offset) is active but the programmed diameter in the tool table doesn't match the actual cutter diameter. Or compensation is intended but not activated, so the program assumes the cutter center travels on the profile line rather than offset by half the diameter.
Fix: Measure actual cutter diameter (worn tools cut smaller than nominal). Enter precise diameter in tool offset register. Verify whether the CAM-generated program uses cutter compensation (G41/G42) or programs the center path directly.

Common CNC Alarm Codes and Their Meanings

Layer Shift (3D Printing)

โŒ Print shifts laterally at some point โ€” layers no longer align
Cause: Stepper motor missed steps due to: print speed too high, belt too loose, belt tooth skipping, stepper current too low, or nozzle collision with a previously printed feature (partial clog causing a blob, collision with ooze).
Fix: Reduce print speed by 20%. Check belt tension โ€” it should twang like a guitar string. Increase stepper driver current (Vref on A4988 or digital setting on TMC2209). Check for ooze blobs catching the nozzle โ€” enable Z-hop in slicer (lifts nozzle on travel moves).

The Best Fix: Simulate Before You Run

At least half of the errors on this page would be caught instantly by loading the G-Code file into GCodex and watching the toolpath play back. Coordinate system errors show up as paths in the wrong location. Arc errors render as broken paths. Incorrect depths are immediately visible in the Z-axis view. Layer shifts in 3D printing show as offset layers in the preview. A 2-minute simulation is the cheapest insurance you can buy.