# Gradle "Could not get unknown property" - Fix Build Script in CI

> Fix Gradle "Could not get unknown property 'x' for <object>" in CI - a referenced project/ext/version-catalog property that does not exist, a typo, or a property defined after it is used.

Source: https://latchkey.dev/learn/java-jvm/gradle-could-not-get-unknown-property  
Updated: 2026-06-25

A build script referenced a property that does not exist on the object it asked. Usually an `ext`/project property, a version-catalog accessor, or a Gradle property is misspelled, never defined, or read before it is set.

## 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
```

> A JVM or Gradle version mismatch between your machine and the runner explains a large share of CI-only Gradle failures. Pin the JDK with `setup-java` and pin Gradle with the wrapper, then confirm both with `./gradlew -version` in CI.

## 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.

## FAQ

### What causes Gradle "Could not get unknown property"?

There are 2 common causes: property never defined or misspelled and property read before it is set. An ext property, a gradle.properties entry, or a version-catalog alias is referenced under a name that was never set, or with a typo (springBootVersion vs springbootVersion).

### How do I fix Gradle "Could not get unknown property"?

There are 2 fixes depending on which cause you have: define the property before using it and prefer a version catalog for shared versions. Work through them in order, since the first is the most common.

### What does Gradle "Could not get unknown property" actually mean?

Configuration fails with Could not get unknown property '<name>' for project ':<module>' (or for a task/extension).

### How do I stop Gradle "Could not get unknown property" happening again?

Define shared versions in a version catalog (libs.versions.toml). The prevention section lists 3 changes that keep it from recurring.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
