Transient receptor potential (TRP) channels are primary sensory molecules in animals and are involved in detecting a diverse range of physical and chemical cues in the environments. Considering the crucial role of TRPA1 channels in nocifensive behaviors and aversive responses across various insect species, activators of TRPA1 are promising candidates for insect pest control. In this study, we demonstrate that 2-methylthiazoline (2MT), an artificial volatile thiazoline compound originally identified as a stimulant for mouse TRPA1, can be utilized as a novel repellent for fruit flies, Drosophila melanogaster. We observed that 2MT induced strong, dose-dependent avoidance behaviors in adult males, regardless of their feeding states, as well as egg laying behavior in females. These aversive responses were mediated by contact chemosensation via TrpA1 and olfaction via odorant receptors. Knocking down TrpA1 revealed the essential roles of bitter taste neurons and nociceptive neurons in the legs and labellum. Furthermore, among five isoforms, TrpA1-C and TrpA1-D exclusively contributed to the aversiveness of 2MT. We also discovered that these isoforms were directly activated by 2MT through covalent modification of evolutionarily conserved cysteine residues. In conclusion, we have identified 2MT as a stimulant for multiple sensory pathways, triggering aversive behaviors in fruit flies. We propose that 2MT and related chemicals may serve as potential resources for developing novel insect repellents.