microg/GmsCore · error · IllegalArgumentException
SecurePaymentsData.value must not be null
Error message
SecurePaymentsData.value must not be null
What it means
SecurePaymentsData's constructor requires a non-null value String and throws IllegalArgumentException when it is null. The value is parcelled to Google Play services, which cannot accept a null payload for this field.
Source
Thrown at play-services-base/src/main/java/com/google/android/gms/wallet/firstparty/pm/SecurePaymentsData.java:31
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;
@SafeParcelable.Class
public class SecurePaymentsData extends AbstractSafeParcelable {
@Field(2)
public final int key;
@Field(3)
public final String value;
@Constructor
public SecurePaymentsData(@Param(2) int key, @Param(3) String value) {
this.key = key;
this.value = value;
if (key <= 0) {
throw new IllegalArgumentException("SecurePaymentsData.key must be > 0");
}
if (value == null) {
throw new IllegalArgumentException("SecurePaymentsData.value must not be null");
}
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
CREATOR.writeToParcel(this, dest, flags);
}
public static final SafeParcelableCreatorAndWriter<SecurePaymentsData> CREATOR = findCreator(SecurePaymentsData.class);
}
View on GitHub (pinned to 157c9d86ac)
Solutions
- Ensure value is non-null before constructing
- Substitute an empty string if a null value is semantically acceptable
- Reject/repair the source record before building the object
Example fix
// before
SecurePaymentsData d = new SecurePaymentsData(key, json.optString("value", null)); // may be null
// after
String v = json.optString("value", "");
SecurePaymentsData d = new SecurePaymentsData(key, v); Defensive patterns
Strategy: validation
Validate before calling
if (value != null) {
SecurePaymentsData d = new SecurePaymentsData(key, value);
} Type guard
// Java lacks null narrowing; use Objects.requireNonNull String v = Objects.requireNonNull(value, "value required");
Try / catch
try { new SecurePaymentsData(key, value); } catch (IllegalArgumentException e) { /* default value to "" or skip */ } Prevention
- Null-check values from JSON/backend before constructing
- Prefer empty-string defaults over null
When it happens
Trigger: Calling new SecurePaymentsData(key, null), or unparcelling data where the value string was not written.
Common situations: Mapping backend responses where the value field is absent (JSON null) straight into the constructor.
Related errors
- SecurePaymentsData.key must be > 0
- deleteAll was set to true but keys were also provided
- Element in keys cannot be null or empty
- deleteAll=true but keys are provided
- retrieveAll was set to true but other constraint(s) was also
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/86e9270f678bde3e.
Report an issue: GitHub.