The high cost of locating faults in programs has motivated the development of techniques that assist in fault localization by automating part of the process of searching for faults. A method to automatically locate faulty code using failure-causing input combination in combinatorial testing is firstly presented in this paper. Firstly, four types of fault locations are figured out by using parameters in the combination to understand the context of the fault. Secondly, based on the four types of fault locations, an algorithm is proposed to isolate candidate faulty code and obtain cause-effect chains of the failure by means of changing values of parameters in the combination. Finally, experiments are carried out on 92 variations of four programs using the known measurement which is improved in search order and search space of code. Results show that the user could avoid searching over 77% of the program in order to localize faults at code-level. Our method has successfully extended the original method of rooting the fault via combinatorial testing from the input-level to the code-level. It could be easily applicable and broadly practicable in combinatorial testing, and greatly narrow down the search focus on code-level faults.