{"record":{"id":"ea13f267edc7735d","repo":"asLody/VirtualApp","slug":"response-is-null","errorCode":null,"errorMessage":"response is null","messagePattern":"response is null","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"VirtualApp/lib/src/main/java/com/lody/virtual/server/accounts/VAccountManagerService.java","lineNumber":125,"sourceCode":"    }\n\n\n    @Override\n    public AuthenticatorDescription[] getAuthenticatorTypes(int userId) {\n        synchronized (cache) {\n            AuthenticatorDescription[] descArray = new AuthenticatorDescription[cache.authenticators.size()];\n            int i = 0;\n            for (AuthenticatorInfo info : cache.authenticators.values()) {\n                descArray[i] = info.desc;\n                i++;\n            }\n            return descArray;\n        }\n    }\n\n    @Override\n    public void getAccountsByFeatures(int userId, IAccountManagerResponse response, String type, String[] features) {\n        if (response == null) throw new IllegalArgumentException(\"response is null\");\n        if (type == null) throw new IllegalArgumentException(\"accountType is null\");\n        AuthenticatorInfo info = getAuthenticatorInfo(type);\n        if (info == null) {\n            Bundle bundle = new Bundle();\n            bundle.putParcelableArray(AccountManager.KEY_ACCOUNTS, new Account[0]);\n            try {\n                response.onResult(bundle);\n            } catch (RemoteException e) {\n                e.printStackTrace();\n            }\n            return;\n        }\n\n        if (features == null || features.length == 0) {\n            Bundle bundle = new Bundle();\n            bundle.putParcelableArray(AccountManager.KEY_ACCOUNTS, getAccounts(userId, type));\n            try {\n                response.onResult(bundle);","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/asLody/VirtualApp/blob/666fefcb5d3f39cc944001c3457c38ffd6544c87/VirtualApp/lib/src/main/java/com/lody/virtual/server/accounts/VAccountManagerService.java#L107-L143","documentation":"VAccountManagerService.getAccountsByFeatures validates its Binder arguments first: a null IAccountManagerResponse is rejected with this IllegalArgumentException because the async reply channel is mandatory for delivering results.","triggerScenarios":"Invoking getAccountsByFeatures over IPC (directly or via AccountManager glue) passing a null response callback object across the binder call.","commonSituations":"Client-side code constructing the IPC request without wiring the response adapter; a stub/mock service call omitting the callback; race where callback was cleared before the call.","solutions":["Always pass a valid IAccountManagerResponse implementation from the client before calling getAccountsByFeatures","Guard client code to construct the response adapter at call time rather than reusing a nullable field","Add a client-side null check on the callback before dispatching the IPC"],"exampleFix":"// before\nmService.getAccountsByFeatures(userId, null, type, features);\n// after\nIAccountManagerResponse response = new AccountManagerResponse(...);\nif (response != null) {\n    mService.getAccountsByFeatures(userId, response, type, features);\n}","handlingStrategy":"validation","validationCode":"if (response == null) {\n    throw new IllegalArgumentException(\"response callback required before IPC call\");\n}\nmService.getAccountsByFeatures(userId, response, type, features);","typeGuard":null,"tryCatchPattern":"try {\n    mService.getAccountsByFeatures(userId, response, type, features);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"response is null\")) {\n        response = newAccountManagerResponse();\n        mService.getAccountsByFeatures(userId, response, type, features);\n    }\n}","preventionTips":["Construct response adapters at call time, never hold nullable callback fields","Null-check callbacks in client wrappers before dispatching IPC","Keep mock/stub service calls consistent with real binder contract"],"tags":["android","ipc","null-argument","accounts"],"backgroundTag":"null-argument","analyzedSha":"666fefcb5d3f39cc944001c3457c38ffd6544c87","analyzedAt":"2026-09-09T11:09:01.694Z","contentChangedAt":"2026-09-09T11:09:01.694Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}