{"record":{"id":"5da6a5390cd2fba2","repo":"MuntashirAkon/AppManager","slug":"invalid-feature-feature","errorCode":null,"errorMessage":"Invalid feature: ${feature}","messagePattern":"Invalid feature: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/crypto/auth/AuthFeatureDemultiplexer.java","lineNumber":54,"sourceCode":"        String auth = intent.getStringExtra(EXTRA_AUTH);\n        String feature = intent.getStringExtra(EXTRA_FEATURE);\n\n        intent.removeExtra(EXTRA_AUTH);\n        intent.removeExtra(EXTRA_FEATURE);\n\n        if (!AuthManager.getKey().equals(auth)) {\n            // Invalid authorization key\n            // TODO: 16/3/22 Display a nice error message\n            finishAndRemoveTask();\n            return;\n        }\n\n        switch (Objects.requireNonNull(feature)) {\n            case \"profile\":\n                launchProfile(intent);\n                break;\n            default:\n                throw new RuntimeException(\"Invalid feature: \" + feature);\n        }\n        finish();\n    }\n\n    public void launchProfile(@NonNull Intent intent) {\n        String profileId = intent.getStringExtra(ProfileApplierActivity.EXTRA_PROFILE_ID);\n        String state = intent.getStringExtra(ProfileApplierActivity.EXTRA_STATE);\n        startActivity(ProfileApplierActivity.getAutomationIntent(getApplicationContext(), profileId, state));\n    }\n}\n","sourceCodeStart":36,"sourceCodeEnd":65,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/crypto/auth/AuthFeatureDemultiplexer.java#L36-L65","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add a case for the missing feature string in handleRequest's switch before the default branch","Fix the sender so it passes a supported feature value (\"profile\")","Log and finish() gracefully instead of throwing for unknown features","Grep for all intent-construction sites that set the feature extra and verify values"],"exampleFix":"// before\ncase \"profile\":\n    launchProfile(intent);\n    break;\ndefault:\n    throw new RuntimeException(\"Invalid feature: \" + feature);\n// after\ncase \"profile\":\n    launchProfile(intent);\n    break;\ncase \"new-feature\":\n    launchNewFeature(intent);\n    break;\ndefault:\n    Log.e(TAG, \"Invalid feature: \" + feature);\n    finish();","handlingStrategy":"validation","validationCode":"String feature = intent.getStringExtra(EXTRA_FEATURE);\nif (!\"profile\".equals(feature)) {\n    Log.w(TAG, \"Unsupported feature: \" + feature);\n    finish();\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    demux.handleRequest(intent);\n} catch (RuntimeException e) {\n    Log.e(TAG, \"Invalid feature request\", e);\n    finish();\n}","preventionTips":["Centralize feature names as constants or an enum shared by senders and the switch","Only construct feature intents via a single factory method","Log-and-finish for unknown features instead of crashing"],"tags":["android","intent-routing","runtime-exception"],"backgroundTag":"invalid-enum-value","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}