have you tried cleaning your phone's charging port? Use a non-abrasive brush and lightly go over your charging port to remove any debris in that area.
Additionally, you can put your phone in safe mode to try to get past this issue.
To put your phone in safe mode:
1. While the phone is on, hold the power button.
2. Once the power button is held, there should a power off menu that appears on the phone.
3. Select and hold the power off option.
4. It should turn green
5. Once it turns green, click it again, and the phone should reboot into safe mode.
Try to charge your phone in safe mode and see if that error message goes away.
Try to see if that helps. If that still does not help, your phone may need a hardware repair.
You can see any Samsung Care authorized UBREAKIFIX or Samsung Experience Store near you for a hardware repair.
Let me know if this helps! Thanks.
I had the same problem and did the followng steps and it worked for me.
1. go to storage settings.
2. in usb settings - clear the cache.
3. Restart phone.
4. When the phone restarts go to battery settings.
5. Disable fast charge and then switch it back on.
6. Put the phone back on charge.
Sometimes there are things in the CACHE that creates this warning. Good luck and let me know if you have sucess.