# Gradle Footguns: Don't add potentially-empty providers to collection properties

DevFeed: [Gradle Footguns: Don't add potentially-empty providers to collection properties](<https://devfeed.tech/articles/gradle-footguns-don-t-add-potentially-empty-providers-to-collection-properties-39034.md>)

Original publisher: [Read original article](<https://www.zacsweers.dev/gradle-footgun-adding-empty-providers-to-collection-properties/>)

Author: Zac Sweers

Published: 2024-09-11T17:33:13Z

Content type: tutorial

Language: en

Sources: [Zac Sweers](<https://devfeed.tech/sources/zac-sweers.md>)

Topics: [Gradle](<https://devfeed.tech/topics/gradle.md>), [bug](<https://devfeed.tech/topics/bug.md>), [properties](<https://devfeed.tech/topics/properties.md>)

Tags: [bug](<https://devfeed.tech/tags/bug.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [properties](<https://devfeed.tech/tags/properties.md>)

## AI overview

The article explains a Gradle bug involving potentially empty providers added to collection properties. An absent provider can clear the property value rather than only its elements, causing exceptions or leaving the property unusable.

## Source excerpt

After pairing with Tony Robalik on a recent weird behavior I was seeing in Gradle, we encountered a deliciously evil bug in Gradle. It's documented a little in Gradle 8.7's release notes (see Better API for updating collection properties), but the basic premise is