I had this problem too. I solved it by removing all JUnit libraries from IntelliJ / Project Structure / Libraries, and then compiling the project, failing, having IntelliJ resolve this by importing the latest version of JUnit.
I'm now on JUnit 5.9.1
I believe the culprit was junit-platform-commons which is now on 1.9.1
I gitgot the idea from this JUnit 5 issue: https://github.com/junit-team/junit5/issues/2881