{"record":{"id":"d0eae06ae9b61b79","repo":"MuntashirAkon/AppManager","slug":"invalid-key-key-installeroption","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/InstallerOption.java","lineNumber":74,"sourceCode":"                    }\n                }\n                return result.setMatched(false);\n            case \"installer_none\":\n                for (String installer: stringValues) {\n                    if (installers.contains(installer)) {\n                        return result.setMatched(false);\n                    }\n                }\n                return result.setMatched(true);\n            case \"regex\":\n                for (String installer : installers) {\n                    if (regexValue.matcher(installer).matches()) {\n                        return result.setMatched(true);\n                    }\n                }\n                return result.setMatched(false);\n            default:\n                throw new UnsupportedOperationException(\"Invalid key \" + key);\n        }\n    }\n\n    @NonNull\n    private static Set<String> getInstallers(@NonNull InstallSourceInfoCompat installSourceInfo) {\n        Set<String> installers = new LinkedHashSet<>();\n        if (installSourceInfo.getInstallingPackageName() != null) {\n            installers.add(installSourceInfo.getInstallingPackageName());\n        }\n        if (installSourceInfo.getInitiatingPackageName() != null) {\n            installers.add(installSourceInfo.getInitiatingPackageName());\n        }\n        if (installSourceInfo.getOriginatingPackageName() != null) {\n            installers.add(installSourceInfo.getOriginatingPackageName());\n        }\n        return installers;\n    }\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/filters/options/InstallerOption.java#L56-L92","documentation":"InstallerOption.test() switches over the configured key (installer_all/installer_any/installer_none/regex/etc.); an unhandled key reaches the default branch and throws UnsupportedOperationException. Keys are normally validated by setKeyValue(), so this indicates the switch does not cover the option's configured key.","triggerScenarios":"A key in InstallerOption's key map lacking a case in test()'s switch; the protected `key` field set directly; stale keys from hand-crafted Parcels or reflection-based construction.","commonSituations":"Adding a new installer-matching key without updating test(); forked or modified builds; deserialization of crafted filter data.","solutions":["Add a case for the key in InstallerOption.test()'s switch.","Assign keys only via setKeyValue().","Keep InstallerOption's key map and test() switch in sync."],"exampleFix":"// before\ndefault:\n    throw new UnsupportedOperationException(\"Invalid key \" + key);\n// after\ncase \"new_installer_key\":\n    return result.setMatched(/* logic */);\ndefault:\n    throw new UnsupportedOperationException(\"Invalid key \" + key);","handlingStrategy":"validation","validationCode":"if (!option.getKeysWithType().containsKey(option.getKey())) {\n    throw new IllegalStateException(\"Unrecognized key: \" + option.getKey());\n}","typeGuard":null,"tryCatchPattern":"try {\n    result = option.test(info, result);\n} catch (UnsupportedOperationException e) {\n    Log.w(TAG, \"Filter option key not supported\", e);\n    result.setMatched(false);\n}","preventionTips":["Synchronize InstallerOption's key map with its test() switch.","Never mutate the key field outside setKeyValue().","Exercise every key in unit tests."],"tags":["java","android","switch-statement","unsupported-operation"],"backgroundTag":"unsupported-operation","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"}