We study a linear regression formulation of machine learning debugging, where data are obtained from two distinct pools of “clean” and “contaminated” data. The goal is to correctly identify the subset of buggy data contained in the contaminated data pool. We propose a novel weighted $M$-estimator that applies a Huber loss to the contaminated data and a squared error loss to the clean data, and derive rigorous statistical properties of the estimator. Our results reveal the dependence between the proper choice of relative weights; the sample sizes of the clean and contaminated data sets; and the ratio between the noise variances of the two datasets. Simulation studies demonstrate the success of our method when applied to debugging tasks involving synthetic and real datasets.