Skip to content
Latchkey

Gradle "Configuration cache problems found" - Causes & Fix

With the configuration cache enabled, Gradle rejects build logic that reads mutable state at execution time or captures non-serializable objects. The build reports configuration-cache problems and fails (when problems are treated as errors) - a correctness gate, not a flake.

What this error means

The build fails with N problems were found storing the configuration cache, each naming an unsupported access like invocation of 'Task.project' at execution time is unsupported or a task field that cannot be serialized.

gradle output
> Configuration cache problems found in this build.
1 problem was found storing the configuration cache.
- Task `:app:myTask` of type `MyTask`: invocation of 'Task.project' at
  execution time is unsupported.
  See https://docs.gradle.org/current/userguide/configuration_cache.html

Diagnose it: get the real failure out of Gradle

Gradle summarises failures aggressively, and the top-level message frequently describes a downstream symptom rather than the cause. Re-run the failing task with diagnostics before changing build logic.

Terminal
# the actual stack, plus what Gradle decided about the build
./gradlew <task> --stacktrace --info

# is a stale daemon or cache involved?
./gradlew --stop
./gradlew <task> --no-daemon --no-build-cache

# what does Gradle think the environment is?
./gradlew -version

Common causes

Reading the project model at execution time

A task action that calls project.<something> (or other live build state) during execution is unsupported - the configuration cache requires inputs to be captured at configuration time.

Capturing a non-serializable object in a task

A task that holds a reference to a non-serializable type (a Project, a Configuration, a live service) cannot be stored in the configuration cache.

How to fix it

Capture inputs at configuration time

Read the values you need into serializable properties during configuration, not in the task action.

build.gradle.kts
abstract class MyTask : DefaultTask() {
    @get:Input abstract val appVersion: Property<String>
    @TaskAction fun run() {
        // use appVersion.get(), NOT project.version at execution time
    }
}
tasks.register<MyTask>("myTask") {
    appVersion.set(project.version.toString())   // captured now
}

Identify problems with the HTML report

Run with the configuration cache and open the report it links to find every offending access.

Terminal
./gradlew build --configuration-cache
# report: build/reports/configuration-cache/<hash>/configuration-cache-report.html
# temporary unblock only:
# ./gradlew build --no-configuration-cache

Configuration cache and CI

  • The configuration cache rejects build logic that reads mutable state at execution time, which is why enabling it surfaces errors an existing build never showed.
  • Run with --configuration-cache-problems=warn first to see the full list rather than failing on the first one.
  • A cached configuration keyed to a different environment is worse than none. Include the JDK version in your cache key.

How to prevent it

  • Capture task inputs into @Input/Property at configuration time, never read live state in actions.
  • Avoid storing Project/Configuration/services in task fields.
  • Run the configuration cache in CI so incompatibilities surface during development.

Frequently asked questions

What causes Gradle "Configuration cache problems found"?
There are 2 common causes: reading the project model at execution time and capturing a non-serializable object in a task. A task action that calls project.<something> (or other live build state) during execution is unsupported - the configuration cache requires inputs to be captured at configuration time.
How do I fix Gradle "Configuration cache problems found"?
There are 2 fixes depending on which cause you have: capture inputs at configuration time and identify problems with the html report. Work through them in order, since the first is the most common.
What does Gradle "Configuration cache problems found" actually mean?
The build fails with N problems were found storing the configuration cache, each naming an unsupported access like invocation of 'Task.project' at execution time is unsupported or a task field that cannot be serialized.
How do I stop Gradle "Configuration cache problems found" happening again?
Capture task inputs into @Input/Property at configuration time, never read live state in actions. The prevention section lists 3 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card