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

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

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 ""N problems were found storing the configuration cache""?
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 "N problems were found storing the configuration cache"?
Read the values you need into serializable properties during configuration, not in the task action.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card