A hydraulic machine comprising: a cylinder; a piston slidably provided in the cylinder; a first electromagnetic valve comprising: a movable unit including a valve element and an armature; and a solenoid coil, the first electromagnetic valve being configured to switch a state of communication between a hydraulic chamber formed by the cylinder and the piston and an outside of the hydraulic chamber by moving the movable unit; a controller for moving the movable unit to a first position by energizing the solenoid coil, the first position being one of a valve open position and a valve closed position; and an electrical signal detector for detecting an electrical signal which the solenoid coil generates when the movable unit moves from the first position to a second position in a state where the solenoid coil is not energized, the second position being the other of the valve open position and the valve closed position, characterized in that the controller is configured to, in a case where the electrical signal is not detected by the electrical signal detector when a phase angle of the piston indicating a position of the piston in each cycle of a reciprocating motion of the piston is in a first range (W 1) including a target phase angle (A 4) of the piston for moving the movable unit to the second position: execute a control mode for controlling the movable unit to be in the second position by maintaining the solenoid coil in the not energized state; and determine an operation state of the first electromagnetic valve based on whether or not the electrical signal is detected by the electrical signal detector when the control mode is executed and the phase angle of the piston is in a second range (W 2) which is at least a part of a range excluding the first range (W 1). a cylinder; a piston slidably provided in the cylinder; a first electromagnetic valve comprising: a movable unit including a valve element and an armature; and a solenoid coil, the first electromagnetic valve being configured to switch a state of communication between a hydraulic chamber formed by the cylinder and the piston and an outside of the hydraulic chamber by moving the movable unit; a controller for moving the movable unit to a first position by energizing the solenoid coil, the first position being one of a valve open position and a valve closed position; and an electrical signal detector for detecting an electrical signal which the solenoid coil generates when the movable unit moves from the first position to a second position in a state where the solenoid coil is not energized, the second position being the other of the valve open position and the valve closed position, characterized in that the controller is configured to, in a case where the electrical signal is not detected by the electrical signal detector when a phase angle of the piston indicating a position of the piston in each cycle of a reciprocating motion of the piston is in a first range (W 1) including a target phase angle (A 4) of the piston for moving the movable unit to the second position: execute a control mode for controlling the movable unit to be in the second position by maintaining the solenoid coil in the not energized state; and determine an operation state of the first electromagnetic valve based on whether or not the electrical signal is detected by the electrical signal detector when the control mode is executed and the phase angle of the piston is in a second range (W 2) which is at least a part of a range excluding the first range (W 1).