microg/GmsCore · error · IllegalArgumentException

deleteAll was set to true but keys were also provided

Error message

deleteAll was set to true but keys were also provided

What it means

DeleteBytesRequest's constructor enforces mutual exclusivity between the 'keys' list and the 'deleteAll' flag. If deleteAll is true and a non-empty keys list is supplied, the request is contradictory (delete everything vs delete specific keys), so the library throws IllegalArgumentException immediately at construction.

Source

Thrown at play-services-auth-blockstore/src/main/java/com/google/android/gms/auth/blockstore/DeleteBytesRequest.java:43

/**
 * A request to delete app data from BlockStore.
 */
@SafeParcelable.Class
public class DeleteBytesRequest extends AbstractSafeParcelable {

    @Field(value = 1, getterName = "getKeys")
    private final List<String> keys;

    @Field(value = 2, getterName = "getDeleteAll")
    private final boolean deleteAll;

    @Constructor
    DeleteBytesRequest(@Param(1) List<String> keys, @Param(2) boolean deleteAll) {
        this.keys = keys;
        this.deleteAll = deleteAll;
        if (deleteAll && keys != null && !keys.isEmpty()) {
            throw new IllegalArgumentException("deleteAll was set to true but keys were also provided");
        }
        for (String key : keys) {
            if (key == null || key.isEmpty()) {
                throw new IllegalArgumentException("Element in keys cannot be null or empty");
            }
        }
    }

    /**
     * Returns the list of keys whose associated data, if any, should be deleted.
     * <p>
     * An empty list means that no key-based filtering will be performed. In other words, no data will be deleted if the key list is empty and no other
     * criterion is provided.
     * <p>
     * Note that the app data that was stored without an explicit key can be deleted with the default key
     * {@link BlockstoreClient#DEFAULT_BYTES_DATA_KEY}.
     */
    @NonNull

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Either clear the keys list (use an empty list) or set deleteAll to false so exactly one deletion mode is chosen.
  2. Prefer DeleteBytesRequest.builder() and set only one of setKeys(...) or setDeleteAll(true).
  3. If a full wipe is intended, call new DeleteBytesRequest(null, true) or the builder with only setDeleteAll(true).

Example fix

// before
DeleteBytesRequest req = new DeleteBytesRequest(Arrays.asList("k1"), true);
// after
DeleteBytesRequest req = new DeleteBytesRequest(Arrays.asList("k1"), false); // or new DeleteBytesRequest(null, true)
Defensive patterns

Strategy: validation

Validate before calling

if (deleteAll && keys != null && !keys.isEmpty()) throw new IllegalArgumentException("Choose either deleteAll or specific keys, not both");

Prevention

When it happens

Trigger: Calling new DeleteBytesRequest(keys, true) with a non-null, non-empty keys list, e.g. building the @Constructor-based request directly (or via protobuf/Parcelable reconstruction) with both fields set.

Common situations: Developers set setDeleteAll(true) intending a full wipe but forgot to clear previously added keys, or a builder/serialization path carries stale keys from a prior request; also occurs when hand-constructing the object with @Constructor instead of the Builder.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06). Data as JSON: /api/errors/0f06395af1445d3e. Report an issue: GitHub.