MuntashirAkon/AppManager · error · RuntimeException

Invalid feature

Error message

Invalid feature: ${feature}

What it means

AuthFeatureDemultiplexer.handleRequest routes an authenticated intent to a feature screen via a switch on the 'feature' string extra. If the extra holds any value other than the supported case (currently only "profile"), the default branch throws a RuntimeException. This is a programming/configuration guard against unknown feature names.

Solutions

  1. Add a case for the missing feature string in handleRequest's switch before the default branch
  2. Fix the sender so it passes a supported feature value ("profile")
  3. Log and finish() gracefully instead of throwing for unknown features
  4. Grep for all intent-construction sites that set the feature extra and verify values

Example fix

// before
case "profile":
    launchProfile(intent);
    break;
default:
    throw new RuntimeException("Invalid feature: " + feature);
// after
case "profile":
    launchProfile(intent);
    break;
case "new-feature":
    launchNewFeature(intent);
    break;
default:
    Log.e(TAG, "Invalid feature: " + feature);
    finish();
Defensive patterns

Strategy: validation

Validate before calling

String feature = intent.getStringExtra(EXTRA_FEATURE);
if (!"profile".equals(feature)) {
    Log.w(TAG, "Unsupported feature: " + feature);
    finish();
    return;
}

Try / catch

try {
    demux.handleRequest(intent);
} catch (RuntimeException e) {
    Log.e(TAG, "Invalid feature request", e);
    finish();
}

Prevention

When it happens

Trigger: onAuthenticated receives an Intent whose EXTRA_FEATURE string is not "profile" — e.g. a typo in the feature constant, an intent built by another component with a removed/renamed feature, or a null/legacy feature value.

Common situations: Refactoring a feature name without updating all intent senders; external components (shortcuts, automation apps) launching the activity with stale feature strings; adding a new feature to the sender but forgetting the switch case.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12). Data as JSON: /api/errors/5da6a5390cd2fba2. Report an issue: GitHub.

Appendix: source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/crypto/auth/AuthFeatureDemultiplexer.java:54

        String auth = intent.getStringExtra(EXTRA_AUTH);
        String feature = intent.getStringExtra(EXTRA_FEATURE);

        intent.removeExtra(EXTRA_AUTH);
        intent.removeExtra(EXTRA_FEATURE);

        if (!AuthManager.getKey().equals(auth)) {
            // Invalid authorization key
            // TODO: 16/3/22 Display a nice error message
            finishAndRemoveTask();
            return;
        }

        switch (Objects.requireNonNull(feature)) {
            case "profile":
                launchProfile(intent);
                break;
            default:
                throw new RuntimeException("Invalid feature: " + feature);
        }
        finish();
    }

    public void launchProfile(@NonNull Intent intent) {
        String profileId = intent.getStringExtra(ProfileApplierActivity.EXTRA_PROFILE_ID);
        String state = intent.getStringExtra(ProfileApplierActivity.EXTRA_STATE);
        startActivity(ProfileApplierActivity.getAutomationIntent(getApplicationContext(), profileId, state));
    }
}

View on GitHub (pinned to 0152f468fc)