By using the Zernike and the Karhunen-Loeve wavefront reconstruction algorithm, the wavefront reconstruction error of a Hartmann sensor on measuring the atmosphere disturbed wavefront was analyzed in this paper. In the condition of without measurement noise, there are two kinds of wavefront reconstruction errors: the mode coupling error causing by finite spatial frequency of sub-apertures and the mode cutting error by using finite mode numbers. It is showed that the wavefront reconstruction error will be minimum while optimal mode numbers were using, and the Karhunen-Loeve algorithm is somewhat better than the Zernike algorithm.