in fairness mine did the same. I ended up rinsing the charging port with water. then let it dry naturally. seemed to sort it tbh. or just use a wireless charger
happened to me with my son a few year ago for no reason but I read that you put the charger in as its about to boot up after switching the phone back on and it did the trick for me never seen the message again.