Intelij injects an init script into Gradle when using a run configuration, this script is not compatible with config caching when the arg file option is enabled (something it sometimes has to do).
Related upstream issues:
A workaround is to edit the run configuration to not use the args files, this works assuming the java command line isnt too long.