Rigging - Inverse Kinematics Snapping
According to your file, IK limits are defined. You need to unlock related axis, or set appropriate angle ranges for consistency, in order to avoid control conflicts.