Is it a message from Gradle when you run from within Intellij, or is it just some IntelliJ highlighting in the build script?
If the latter, I’d say it is an IJ bug and you should report it to JetBrains.
You could also try to invalidate your IJ caches, this often helps if IJ behaves strange in similar ways.
If the former, it could be both and an MCVE would probably be helpful.