{"record":{"id":"213b2044ad9f8595","repo":"MuntashirAkon/AppManager","slug":"invalid-key-key-runningappsoption","errorCode":null,"errorMessage":"Invalid key ${key}","messagePattern":"Invalid key (.+?)","errorType":"validation","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/filters/options/RunningAppsOption.java","lineNumber":43,"sourceCode":"\n    @NonNull\n    @Override\n    public Map<String, Integer> getKeysWithType() {\n        return mKeysWithType;\n    }\n\n    @NonNull\n    @Override\n    public TestResult test(@NonNull IFilterableAppInfo info, @NonNull TestResult result) {\n        switch (key) {\n            case KEY_ALL:\n                return result.setMatched(true);\n            case \"running\":\n                return result.setMatched(info.isRunning());\n            case \"not_running\":\n                return result.setMatched(!info.isRunning());\n            default:\n                throw new UnsupportedOperationException(\"Invalid key \" + key);\n        }\n    }\n\n    @NonNull\n    @Override\n    public CharSequence toLocalizedString(@NonNull Context context) {\n        SpannableStringBuilder sb = new SpannableStringBuilder(\"App label\");\n        switch (key) {\n            case KEY_ALL:\n                return \"Both running and not running apps\";\n            case \"running\":\n                return \"Only the running apps\";\n            case \"not_running\":\n                return \"Only the not running apps\";\n            default:\n                throw new UnsupportedOperationException(\"Invalid key \" + key);\n        }\n    }","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/filters/options/RunningAppsOption.java#L25-L61","documentation":"RunningAppsOption.test classifies apps by switching on key ('running', 'not_running', plus an always-match case). An unrecognized key reaches default and throws UnsupportedOperationException 'Invalid key <key>'. The option got a state key it does not implement.","triggerScenarios":"Calling test() on a RunningAppsOption whose key is not exactly 'running' or 'not_running' (or the both-case sentinel) — e.g. 'is_running' from a typo or another option's vocabulary.","commonSituations":"Edited filter JSON; key sets drifting between app versions; building filters programmatically with guessed key names.","solutions":["Change the key to 'running' or 'not_running'.","Re-create the filter in the UI.","Validate the key at option construction.","Add the missing case if a new mode is needed."],"exampleFix":"// before\nnew RunningAppsOption(\"running_apps\", \"is_running\");\n// after\nnew RunningAppsOption(\"running_apps\", \"running\");","handlingStrategy":"validation","validationCode":"if (!(\"running\".equals(k) || \"not_running\".equals(k))) throw new IllegalArgumentException(\"Unsupported running_apps key: \" + k);","typeGuard":"boolean isValidKey(String k) { return \"running\".equals(k) || \"not_running\".equals(k); }","tryCatchPattern":"try { matched = option.test(info); } catch (UnsupportedOperationException e) { matched = false; }","preventionTips":["Use exactly 'running' or 'not_running'","Validate keys when building the option","Don't reuse keys from other option types","Version-check imported filters"],"tags":["android","filter-options","unsupported-key","running-apps"],"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-14T16:17:12.679Z"}