{"record":{"id":"7c4409814f20eab1","repo":"MuntashirAkon/AppManager","slug":"invalid-type-type","errorCode":null,"errorMessage":"Invalid type + type","messagePattern":"Invalid type \\+ type","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/io/fs/VirtualFileSystem.java","lineNumber":127,"sourceCode":"        return new Uri.Builder()\n                .scheme(SCHEME)\n                .authority(String.valueOf(fsId))\n                .path(path != null ? path : File.separator)\n                .build();\n    }\n\n    @NonNull\n    private static VirtualFileSystem getNewInstance(@NonNull Path file, @NonNull String type) {\n        if (ZipFileSystem.TYPE.equals(type)) {\n            return new ZipFileSystem(file);\n        }\n        if (ApkFileSystem.TYPE.equals(type)) {\n            return new ApkFileSystem(file);\n        }\n        if (DexFileSystem.TYPE.equals(type)) {\n            return new DexFileSystem(file);\n        }\n        throw new IllegalArgumentException(\"Invalid type \" + type);\n    }\n\n    private static final SparseArrayCompat<VirtualFileSystem> sFileSystems = new SparseArrayCompat<>(3);\n    private static final HashMap<Uri, Integer> sUriVfsIdsMap = new HashMap<>(3);\n    private static final HashMap<Uri, List<Integer>> sParentUriVfsIdsMap = new HashMap<>(3);\n\n    @WorkerThread\n    public static int mount(@NonNull Uri mountPoint, @NonNull Path file, @NonNull String type) throws IOException {\n        return mount(mountPoint, file, type, new MountOptions.Builder().build());\n    }\n\n    @WorkerThread\n    public static int mount(@NonNull Uri mountPoint,\n                            @NonNull Path file,\n                            @NonNull String type,\n                            @NonNull MountOptions options)\n            throws IOException {\n        return mount(mountPoint, getNewInstance(file, type), options);","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/io/fs/VirtualFileSystem.java#L109-L145","documentation":"VirtualFileSystem.getNewInstance maps a registered filesystem TYPE string ('apk', 'dex', ...) to a concrete VirtualFileSystem subclass. When called with a type string no factory branch matches, it throws IllegalArgumentException(\"Invalid type \" + type). Callers pass the type taken from MountOptions or persistence, so this indicates a type the current build cannot instantiate.","triggerScenarios":"Calling VirtualFileSystem.mount with MountOptions whose filesystem type string is misspelled, from a newer/older app version that introduced or removed a VFS type, or persisted metadata referencing an unregistered type.","commonSituations":"Restoring saved mount configurations after an app update that renamed a type constant; hand-written mount scripts using a wrong type string; plugin/pro-guard stripping of a filesystem class.","solutions":["Use the exact TYPE constants (ApkFileSystem.TYPE / DexFileSystem.TYPE) rather than literal strings.","Validate the options' type against the supported set before mounting.","Fix persisted/saved mount metadata to a type supported by the installed app version.","Catch IllegalArgumentException and surface the supported type list to the user."],"exampleFix":"// before\nnew MountOptions().setType(\"zip\");\n// after\nString type = ApkFileSystem.TYPE; // or DexFileSystem.TYPE\nif (!type.equals(ApkFileSystem.TYPE) && !type.equals(DexFileSystem.TYPE)) throw new IllegalArgumentException(type);\nnew MountOptions().setType(type);","handlingStrategy":"validation","validationCode":"Set<String> supported = Set.of(ApkFileSystem.TYPE, DexFileSystem.TYPE);\nif (!supported.contains(options.getType())) throw new IllegalArgumentException(\"Unsupported VFS type: \" + options.getType());","typeGuard":null,"tryCatchPattern":"try {\n    VirtualFileSystem.mount(mountPoint, options);\n} catch (IllegalArgumentException e) {\n    // fall back to a supported type or report supported types\n}","preventionTips":["Always use the TYPE constants instead of string literals.","Validate saved mount metadata against supported types after app updates.","Keep type strings and VFS classes in sync across versions (migration code)."],"tags":["filesystem","invalid-argument","android"],"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"}