{"record":{"id":"e57e0b7cd96df194","repo":"MuntashirAkon/AppManager","slug":"invalid-key-key-minsdkoption","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/MinSdkOption.java","lineNumber":53,"sourceCode":"    }\n\n    @NonNull\n    @Override\n    public TestResult test(@NonNull IFilterableAppInfo info, @NonNull TestResult result) {\n        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {\n            return result.setMatched(true);\n        }\n        switch (key) {\n            case KEY_ALL:\n                return result.setMatched(true);\n            case \"eq\":\n                return result.setMatched(info.getMinSdk() == intValue);\n            case \"le\":\n                return result.setMatched(info.getMinSdk() <= intValue);\n            case \"ge\":\n                return result.setMatched(info.getMinSdk() >= intValue);\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(\"Minimum SDK\");\n        switch (key) {\n            case KEY_ALL:\n                return sb.append(LangUtils.getSeparatorString()).append(\"any\");\n            case \"eq\":\n                return sb.append(\" = \").append(Integer.toString(intValue));\n            case \"le\":\n                return sb.append(\" ≤ \").append(Integer.toString(intValue));\n            case \"ge\":\n                return sb.append(\" ≥ \").append(Integer.toString(intValue));\n            default:\n                throw new UnsupportedOperationException(\"Invalid key \" + key);","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/filters/options/MinSdkOption.java#L35-L71","documentation":"MinSdkOption.test matches an application's minimum SDK against the configured comparison by switching on key ('eq', 'le', 'ge'). An unrecognized key reaches the default branch and throws UnsupportedOperationException 'Invalid key <key>'. The filter's comparison key is not a valid MinSdk operator.","triggerScenarios":"Calling test() on a MinSdkOption whose key is not exactly 'eq', 'le', or 'ge' — typically from a deserialized filter file with a typo, a renamed key across versions, or an operator borrowed from another option type.","commonSituations":"Hand-edited filter JSON using '<' or '<=' instead of 'le'; copying a key from a different filter option (e.g. 'before'); filters shared between app versions with differing key sets.","solutions":["Change the key in the filter config to 'eq', 'le', or 'ge'.","Re-create the filter via the app UI.","Update/downgrade App Manager so the key set matches the one that created the filter.","Validate the key when constructing the option; fail fast with a clear message."],"exampleFix":"// before\nnew MinSdkOption(\"min_sdk\", \"<=\", 24);\n// after\nnew MinSdkOption(\"min_sdk\", \"le\", 24);","handlingStrategy":"validation","validationCode":"Set<String> VALID = Set.of(\"eq\", \"le\", \"ge\");\nif (!VALID.contains(option.getKey())) throw new IllegalArgumentException(\"Unsupported min_sdk key: \" + option.getKey());","typeGuard":"boolean isValidKey(String k) { return \"eq\".equals(k) || \"le\".equals(k) || \"ge\".equals(k); }","tryCatchPattern":"try { matched = option.test(info); } catch (UnsupportedOperationException e) { Log.w(TAG, e.getMessage()); matched = false; }","preventionTips":["Use the canonical operator keys eq/le/ge","Validate keys at filter deserialization","Avoid copying keys between different option types","Test filters after app upgrades"],"tags":["android","filter-options","unsupported-key","min-sdk"],"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"}