The invalid SIM card error appears on Android phones for different reasons. Most of the time, this is due to a simple bug. A force restart should help. If not, turning airplane mode on and off should fix the invalid SIM card issue. The last resort would be to factory reset. Your entire system would be wiped to fix the problem. This is the way to go if the problem is due to a stubborn bug.
More info at: https://grouphowto.com/invalid-sim-card/