Abstract Vortex motion can lead to significant energy dissipation, resulting in hot spots and thermomagnetic instabilities that are detrimental to the application of superconductors. This paper presents a theoretical examination of thermomagnetic instabilities triggered by vortex motion within a Nb$_{3}$Sn-I-Nb cavity featuring a multilayer structure. The investigation is conducted using Ginzburg-Landau theory in conjunction with the heat diffusion equation. The numerical simulations align well with experimental data from Nb$_{3}$Sn superconducting cavities. Given that the performance of SRF cavities is highly sensitive to various defects, this study also considers the interaction between vortices and these defects. It reveals the impact of edge cracks and impurities on temperature rise and the quality factor. The findings indicate that edge cracks significantly reduce the threshold field for thermomagnetic instability in superconducting radio-frequency (SRF) cavities. The performance of SRF cavities is influenced not only by the RF field amplitude and frequency but also by the length and number of edge cracks. These results offer valuable insights for evaluating the performance of SRF cavities subjected to RF fields.