asLody/VirtualApp · error · java.lang.IllegalArgumentException

response is null

Error message

response is null

What it means

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.

Solutions

  1. Always pass a valid IAccountManagerResponse implementation from the client before calling getAccountsByFeatures
  2. Guard client code to construct the response adapter at call time rather than reusing a nullable field
  3. Add a client-side null check on the callback before dispatching the IPC

Example fix

// before
mService.getAccountsByFeatures(userId, null, type, features);
// after
IAccountManagerResponse response = new AccountManagerResponse(...);
if (response != null) {
    mService.getAccountsByFeatures(userId, response, type, features);
}
Defensive patterns

Strategy: validation

Validate before calling

if (response == null) {
    throw new IllegalArgumentException("response callback required before IPC call");
}
mService.getAccountsByFeatures(userId, response, type, features);

Try / catch

try {
    mService.getAccountsByFeatures(userId, response, type, features);
} catch (IllegalArgumentException e) {
    if (e.getMessage() != null && e.getMessage().contains("response is null")) {
        response = newAccountManagerResponse();
        mService.getAccountsByFeatures(userId, response, type, features);
    }
}

Prevention

When it happens

Trigger: Invoking getAccountsByFeatures over IPC (directly or via AccountManager glue) passing a null response callback object across the binder call.

Common situations: 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.

Related errors


AI-assisted analysis of asLody/VirtualApp@666fefcb5d (2026-09-09). Data as JSON: /api/errors/ea13f267edc7735d. Report an issue: GitHub.

Appendix: source

Thrown at VirtualApp/lib/src/main/java/com/lody/virtual/server/accounts/VAccountManagerService.java:125

    }


    @Override
    public AuthenticatorDescription[] getAuthenticatorTypes(int userId) {
        synchronized (cache) {
            AuthenticatorDescription[] descArray = new AuthenticatorDescription[cache.authenticators.size()];
            int i = 0;
            for (AuthenticatorInfo info : cache.authenticators.values()) {
                descArray[i] = info.desc;
                i++;
            }
            return descArray;
        }
    }

    @Override
    public void getAccountsByFeatures(int userId, IAccountManagerResponse response, String type, String[] features) {
        if (response == null) throw new IllegalArgumentException("response is null");
        if (type == null) throw new IllegalArgumentException("accountType is null");
        AuthenticatorInfo info = getAuthenticatorInfo(type);
        if (info == null) {
            Bundle bundle = new Bundle();
            bundle.putParcelableArray(AccountManager.KEY_ACCOUNTS, new Account[0]);
            try {
                response.onResult(bundle);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
            return;
        }

        if (features == null || features.length == 0) {
            Bundle bundle = new Bundle();
            bundle.putParcelableArray(AccountManager.KEY_ACCOUNTS, getAccounts(userId, type));
            try {
                response.onResult(bundle);

View on GitHub (pinned to 666fefcb5d)