The influence of vacancy defect on the doping of silicon nanowires is systematically studied by the first-principles calculations. The atomic structures and electronic properties of vacancies and vacancy-boron (vacancy-phosphor) com- plexes in H-passivated silicon nanowire with a diameter of 2.3 nm are explored. The results of geometry optimization indicate that a central vacancy can exist stably, while the vacancy at the edge of the nanowire undergoes a local surface reconstruction, which results in the extradition of the vacancy out of the nanowire. Total-energy calculations indicate that the central vacancy tends to form a vacancy-dopant defect pair. Further analysis shows that n-type doping efficiency is strongly inhibited by the unintentional vacancy defect. In contrast, the vacancy defect has little effect on p-type doping. Our results suggest that the vacancy defect should be avoided during the growth and the fabrication of devices.