Is it a false error, Have you tried rebuilding either in VScode or with live code? -
Edit what usually works for me is in Unreal - tools - Refresh Visual Studio Code Project!
After this if the problem still persists please show the error log at the bottom of VSCode or in Unreal