microg/GmsCore · error · IllegalArgumentException
Binder object is null.
Error message
Binder object is null.
What it means
During ObjectWrapper.unwrap, field.get(binder) threw a NullPointerException, which the library rethrows as IllegalArgumentException('Binder object is null.'). This means the field holding the wrapped object is null on that binder instance — effectively the wrapper wraps nothing (null) and the code path assumes non-null.
Source
Thrown at play-services-basement/src/main/java/com/google/android/gms/dynamic/ObjectWrapper.java:76
}
if (field == null) {
field = currentField;
} else {
throw new IllegalArgumentException("Too many non-synthetic fields were found");
}
}
if (field == null) {
throw new IllegalArgumentException("No non-synthetic fields were found");
}
if (!field.isAccessible()) {
field.setAccessible(true);
try {
return field.get(binder);
} catch (NullPointerException localNullPointerException) {
throw new IllegalArgumentException("Binder object is null.",
localNullPointerException);
} catch (IllegalArgumentException localIllegalArgumentException) {
throw new IllegalArgumentException("remoteBinder is the wrong class.",
localIllegalArgumentException);
} catch (IllegalAccessException localIllegalAccessException) {
throw new IllegalArgumentException("Could not access the field in remoteBinder.",
localIllegalAccessException);
}
} else {
throw new IllegalArgumentException();
}
}
@Nullable
public static <T> T unwrapTyped(IObjectWrapper obj, Class<T> clazz) {
try {
return clazz.cast(unwrap(obj));
} catch (ClassCastException e) {View on GitHub (pinned to 157c9d86ac)
Solutions
- Ensure the object passed to ObjectWrapper.wrap is non-null, or skip the call when you know it's null
- Null-check the field value before wrapping: if (obj == null) return;
- Catch IllegalArgumentException from unwrap* and treat it as 'value absent'
- Return an Optional/nullable result instead of wrapping null
Example fix
// before
return ObjectWrapper.unwrapTyped(w, MyType.class); // NPE if w wraps null
// after
if (w == null) return null;
try {
return ObjectWrapper.unwrapTyped(w, MyType.class);
} catch (IllegalArgumentException e) {
return null;
} Defensive patterns
Strategy: type-guard
Validate before calling
if (wrapper == null) return null;
IBinder b = wrapper.asBinder();
for (Field f : b.getClass().getDeclaredFields()) {
if (!f.isSynthetic()) { f.setAccessible(true); if (f.get(b) == null) return null; }
} Type guard
boolean isNonNullWrapper(IObjectWrapper w) {
if (w == null) return false;
try { ObjectWrapper.unwrap(w); return true; }
catch (IllegalArgumentException e) { return false; }
} Try / catch
try {
T value = ObjectWrapper.unwrapTyped(wrapper, T.class);
} catch (IllegalArgumentException e) {
value = null; // wrapped object was null
} Prevention
- Never call ObjectWrapper.wrap(null)
- Return Optional/null early instead of wrapping absent values
- Validate producer outputs before crossing the binder boundary
When it happens
Trigger: ObjectWrapper.wrap(null) or an ObjectWrapper constructed with a null field value, then passed across the binder interface and later unwrapped with unwrap()/unwrapTyped().
Common situations: Upstream API returning null wrapped in an ObjectWrapper; a field that failed to initialize before being wrapped; Optional-style flows where 'absent' is encoded as a null wrapper.
Related errors
- No fields were found
- Too many non-synthetic fields were found
- remoteBinder is the wrong class.
- suggested UID [
- suggested PID [
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/9b3831d3444fa232.
Report an issue: GitHub.