A work machine comprising: a work implement attached to a machine main body; an operation sensor that detects an operation of the work implement by an operator; a pressure sensor that detects a pressure on a hydraulic actuator (9,10,11) that drives the work implement; a posture sensor that detects a posture of the work implement; an antenna (28a, 28b) that is attached to the machine main body and receives satellite signals from a plurality of positioning satellites; a receiver configured to calculate a position of the machine main body on a basis of the satellite signals received by the antenna (28a, 28b); a first communication device that receives, from a base station, a correction signal used when the receiver calculates the position of the machine main body; and a controller having a storage device storing a position of a construction target surface, and configured to calculate magnitude of a position difference in a height direction between the construction target surface and the work implement on a basis of the position of the construction target surface stored in the storage device, the position of the machine main body calculated by the receiver, and the posture of the work implement detected by the posture sensor, characterized in that the controller being configured to record, in the storage device, snapshot data of information about the operation sensor, the pressure sensor, the posture sensor, the receiver, and the first communication device in a predetermined period determined based on a time at which the magnitude of the position difference exceeds a predetermined value when the magnitude of the position difference exceeds the predetermined value, and diagnose a cause of the magnitude of the position difference exceeding the predetermined value, on a basis of the snapshot data. a work implement attached to a machine main body; an operation sensor that detects an operation of the work implement by an operator; a pressure sensor that detects a pressure on a hydraulic actuator (9,10,11) that drives the work implement; a posture sensor that detects a posture of the work implement; an antenna (28a, 28b) that is attached to the machine main body and receives satellite signals from a plurality of positioning satellites; a receiver configured to calculate a position of the machine main body on a basis of the satellite signals received by the antenna (28a, 28b); a first communication device that receives, from a base station, a correction signal used when the receiver calculates the position of the machine main body; and a controller having a storage device storing a position of a construction target surface, and configured to calculate magnitude of a position difference in a height direction between the construction target surface and the work implement on a basis of the position of the construction target surface stored in the storage device, the position of the machine main body calculated by the receiver, and the posture of the work implement detected by the posture sensor, characterized in that the controller being configured to record, in the storage device, snapshot data of information about the operation sensor, the pressure sensor, the posture sensor, the receiver, and the first communication device in a predetermined period determined based on a time at which the magnitude of the position difference exceeds a predetermined value when the magnitude of the position difference exceeds the predetermined value, and diagnose a cause of the magnitude of the position difference exceeding the predetermined value, on a basis of the snapshot data.