{"record":{"id":"6278b14b2caa3239","repo":"MuntashirAkon/AppManager","slug":"unknown-type-type","errorCode":null,"errorMessage":"Unknown type: ${type}","messagePattern":"Unknown type: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/filters/options/BloatwareOption.java","lineNumber":102,"sourceCode":"            default:\n                throw new UnsupportedOperationException(\"Invalid key \" + key);\n        }\n    }\n\n    public int typeToFlag(@NonNull String type) {\n        switch (type) {\n            case \"aosp\":\n                return FILTER_LIST_AOSP;\n            case \"carrier\":\n                return FILTER_LIST_CARRIER;\n            case \"google\":\n                return FILTER_LIST_GOOGLE;\n            case \"misc\":\n                return FILTER_LIST_MISC;\n            case \"oem\":\n                return FILTER_LIST_OEM;\n            default:\n                throw new IllegalArgumentException(\"Unknown type: \" + type);\n        }\n    }\n\n    @NonNull\n    @Override\n    public CharSequence toLocalizedString(@NonNull Context context) {\n        SpannableStringBuilder sb = new SpannableStringBuilder(\"Bloatware\");\n        switch (key) {\n            case KEY_ALL:\n                return sb.append(LangUtils.getSeparatorString()).append(\"any\");\n            case \"type\":\n                return sb.append(\" with type: \").append(flagsToString(\"type\", intValue));\n            case \"removal\":\n                return sb.append(\" with removal: \").append(flagsToString(\"removal\", intValue));\n            default:\n                throw new UnsupportedOperationException(\"Invalid key \" + key);\n        }\n    }","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/filters/options/BloatwareOption.java#L84-L120","documentation":"BloatwareOption.typeToFlag() converts a bloatware type string (aosp, google, misc, oem, etc.) into its corresponding filter-list flag constant; unknown strings hit the default branch and throw IllegalArgumentException(\"Unknown type: \" + type). It guards the mapping between type names and the static FILTER_LIST_* bit sets, and is reached from test() when the \"type\" key is used.","triggerScenarios":"Calling BloatwareOption with key \"type\" and an intValue whose matching type string (or object.type value from the bloatware list entry) is not one of the recognized names when typeToFlag() runs.","commonSituations":"Bloatware list JSON containing a new/renamed type not yet mapped in typeToFlag(); user-edited custom bloatware lists; version skew where the list format added types the app doesn't know.","solutions":["Ensure the bloatware list's type field only uses recognized values (\"aosp\", \"google\", \"misc\", \"oem\", and any other mapped names)","Add a case to typeToFlag() mapping any newly introduced type to its FILTER_LIST_* flag","Update the app or the bloatware list definitions so both sides use the same type names","Sanitize/pre-validate the list's type values when loading it, skipping unknown types"],"exampleFix":"// before\n// bloatware.json: { \"name\": \"Foo\", \"type\": \"vendor\" }  // unmapped type\nboolean m = option.test(packageInfo).isMatched(); // throws\n// after\n// fix the list entry\n// { \"name\": \"Foo\", \"type\": \"oem\" }\nboolean m = option.test(packageInfo).isMatched();","handlingStrategy":"validation","validationCode":"Set<String> KNOWN_TYPES = Set.of(\"aosp\",\"google\",\"misc\",\"oem\"); if (!KNOWN_TYPES.contains(entry.type)) { Log.warn(\"Skipping bloatware entry with unknown type \" + entry.type); return; }","typeGuard":"boolean isKnownBloatType(String type) { return type != null && Set.of(\"aosp\",\"google\",\"misc\",\"oem\").contains(type); }","tryCatchPattern":"try { boolean matched = option.test(packageInfo).isMatched(); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Unknown type\")) { matched = false; /* treat unknown type as non-matching */ } else throw e; }","preventionTips":["Keep bloatware list type vocabulary in sync with typeToFlag()'s mapping","Sanitize third-party/custom bloatware lists on load","Add a test that maps every documented type to a flag","Handle new upstream list types in app updates promptly"],"tags":["android","filters","bloatware","invalid-enum-value"],"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-14T11:17:12.474Z"}