microg/GmsCore · error · IllegalArgumentException

ParcelableKeyValue.value must not be null

Error message

ParcelableKeyValue.value must not be null

What it means

ParcelableKeyValue's constructor requires a non-null value and throws IllegalArgumentException when value == null. The value is part of the parcelled payload exchanged with Play services and must be present.

Source

Thrown at play-services-base/src/main/java/com/google/android/wallet/bender3/framework/client/ParcelableKeyValue.java:31

import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;

@SafeParcelable.Class
public class ParcelableKeyValue extends AbstractSafeParcelable {
    @Field(2)
    public final int key;
    @Field(3)
    public final String value;

    @Constructor
    public ParcelableKeyValue(@Param(2) int key, @Param(3) String value) {
        this.key = key;
        this.value = value;
        if (key <= 0) {
            throw new IllegalArgumentException("ParcelableKeyValue.key must be > 0");
        }
        if (value == null) {
            throw new IllegalArgumentException("ParcelableKeyValue.value must not be null");
        }
    }

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        CREATOR.writeToParcel(this, dest, flags);
    }

    public static final SafeParcelableCreatorAndWriter<ParcelableKeyValue> CREATOR = findCreator(ParcelableKeyValue.class);
}

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Provide a non-null value when constructing
  2. Default to empty string when the value is genuinely absent
  3. Filter out null-valued records before mapping to ParcelableKeyValue

Example fix

// before
ParcelableKeyValue kv = new ParcelableKeyValue(key, map.get("value")); // may be null
// after
ParcelableKeyValue kv = new ParcelableKeyValue(key, Objects.toString(map.get("value"), ""));
Defensive patterns

Strategy: validation

Validate before calling

if (key > 0 && value != null) {
    ParcelableKeyValue kv = new ParcelableKeyValue(key, value);
}

Type guard

String v = Objects.requireNonNull(value, "value required");

Try / catch

try { new ParcelableKeyValue(key, value); } catch (IllegalArgumentException e) { /* skip null-valued record */ }

Prevention

When it happens

Trigger: Calling new ParcelableKeyValue(key, null), or reading a Parcel whose value field is missing/null.

Common situations: Deserializing records where the value field is optional upstream but mandatory in this client-side class.

Related errors


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