{"record":{"id":"09d5c45bd53e0a5b","repo":"microg/GmsCore","slug":"parcelablekeyvalue-value-must-not-be-null","errorCode":null,"errorMessage":"ParcelableKeyValue.value must not be null","messagePattern":"ParcelableKeyValue\\.value must not be null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"play-services-base/src/main/java/com/google/android/wallet/bender3/framework/client/ParcelableKeyValue.java","lineNumber":31,"sourceCode":"import com.google.android.gms.common.internal.safeparcel.SafeParcelable;\nimport com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;\n\n@SafeParcelable.Class\npublic class ParcelableKeyValue extends AbstractSafeParcelable {\n    @Field(2)\n    public final int key;\n    @Field(3)\n    public final String value;\n\n    @Constructor\n    public ParcelableKeyValue(@Param(2) int key, @Param(3) String value) {\n        this.key = key;\n        this.value = value;\n        if (key <= 0) {\n            throw new IllegalArgumentException(\"ParcelableKeyValue.key must be > 0\");\n        }\n        if (value == null) {\n            throw new IllegalArgumentException(\"ParcelableKeyValue.value must not be null\");\n        }\n    }\n\n    @Override\n    public void writeToParcel(@NonNull Parcel dest, int flags) {\n        CREATOR.writeToParcel(this, dest, flags);\n    }\n\n    public static final SafeParcelableCreatorAndWriter<ParcelableKeyValue> CREATOR = findCreator(ParcelableKeyValue.class);\n}\n","sourceCodeStart":13,"sourceCodeEnd":42,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-base/src/main/java/com/google/android/wallet/bender3/framework/client/ParcelableKeyValue.java#L13-L42","documentation":"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.","triggerScenarios":"Calling new ParcelableKeyValue(key, null), or reading a Parcel whose value field is missing/null.","commonSituations":"Deserializing records where the value field is optional upstream but mandatory in this client-side class.","solutions":["Provide a non-null value when constructing","Default to empty string when the value is genuinely absent","Filter out null-valued records before mapping to ParcelableKeyValue"],"exampleFix":"// before\nParcelableKeyValue kv = new ParcelableKeyValue(key, map.get(\"value\")); // may be null\n// after\nParcelableKeyValue kv = new ParcelableKeyValue(key, Objects.toString(map.get(\"value\"), \"\"));","handlingStrategy":"validation","validationCode":"if (key > 0 && value != null) {\n    ParcelableKeyValue kv = new ParcelableKeyValue(key, value);\n}","typeGuard":"String v = Objects.requireNonNull(value, \"value required\");","tryCatchPattern":"try { new ParcelableKeyValue(key, value); } catch (IllegalArgumentException e) { /* skip null-valued record */ }","preventionTips":["Filter null-valued map entries before conversion","Default missing values to empty string"],"tags":["null","parcel","android"],"backgroundTag":"null-argument","analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}