{"record":{"id":"5111a5b1c929b4ab","repo":"microg/GmsCore","slug":"no-fields-were-found","errorCode":null,"errorMessage":"No fields were found","messagePattern":"No fields were found","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"play-services-basement/src/main/java/com/google/android/gms/dynamic/ObjectWrapper.java","lineNumber":46,"sourceCode":"    public ObjectWrapper(T t) {\n        this.t = t;\n    }\n\n    @Nullable\n    public static Object unwrap(IObjectWrapper obj) {\n        if (obj == null) {\n            return null;\n        }\n\n        if (obj instanceof ObjectWrapper) {\n            return ((ObjectWrapper) obj).t;\n        }\n\n        IBinder binder = obj.asBinder();\n        Field[] fields = binder.getClass().getDeclaredFields();\n\n        if (fields.length < 1) {\n            throw new IllegalArgumentException(\"No fields were found\");\n        }\n\n        // Ignore synthetic field(s) from JaCoCo or elsewhere\n        // https://www.jacoco.org/jacoco/trunk/doc/faq.html\n\n        @Nullable\n        Field field = null;\n\n        for (Field currentField : fields) {\n            if (currentField.isSynthetic()) {\n                continue;\n            }\n\n            if (field == null) {\n                field = currentField;\n            } else {\n                throw new IllegalArgumentException(\"Too many non-synthetic fields were found\");\n            }","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-basement/src/main/java/com/google/android/gms/dynamic/ObjectWrapper.java#L28-L64","documentation":"ObjectWrapper.unwrap reflects over the underlying binder's class to find the wrapped object's field. It throws IllegalArgumentException('No fields were found') when the binder's class declares zero fields, which means the object passed is not a real ObjectWrapper remote binder.","triggerScenarios":"Calling ObjectWrapper.unwrap() on an IObjectWrapper whose asBinder() class has no declared fields — typically a Mockito-style mock, a lambda/proxy subclass, or an ObjectWrapper created by a different/older library version whose internal layout changed.","commonSituations":"Unit tests injecting mocked IObjectWrapper instances into production code; proguard/R8 renaming or stripping the field; mixed play-services versions in a multi-module build.","solutions":["Pass only IObjectWrapper instances created via ObjectWrapper.wrap(obj), not mocks or hand-built implementations","Disable proguard minification/obfuscation for com.google.android.gms.dynamic.** (keep class members)","Align play-services-basement versions across all modules","In tests, use ObjectWrapper.wrap(realObject) instead of Mockito.mock(IObjectWrapper.class)"],"exampleFix":"// before\nIObjectWrapper w = Mockito.mock(IObjectWrapper.class);\nMyType t = ObjectWrapper.unwrapTyped(w, MyType.class); // throws\n// after\nIObjectWrapper w = ObjectWrapper.wrap(new MyTypeImpl());\nMyType t = ObjectWrapper.unwrapTyped(w, MyType.class);","handlingStrategy":"try-catch","validationCode":"if (wrapper == null) return null;\nIBinder b = wrapper.asBinder();\nif (b == null || b.getClass().getDeclaredFields().length == 0) return null; // would throw","typeGuard":"boolean isWrappable(IObjectWrapper w) {\n    if (w == null) return false;\n    IBinder b = w.asBinder();\n    return b != null && b.getClass().getDeclaredFields().length >= 1;\n}","tryCatchPattern":"try {\n    T value = ObjectWrapper.unwrapTyped(wrapper, T.class);\n} catch (IllegalArgumentException e) {\n    Log.w(TAG, \"unwrap failed\", e);\n    value = null;\n}","preventionTips":["Only unwrap wrappers created by ObjectWrapper.wrap","Never use Mockito mocks for IObjectWrapper in production code paths","Keep gms dynamic classes excluded from code coverage instrumentation","Pin a single play-services-basement version across modules"],"tags":["android","binder","reflection","mocking"],"backgroundTag":"type-mismatch","analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}