MuntashirAkon/AppManager · error · IllegalArgumentException
Invalid type + type
Error message
Invalid type + type
What it means
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.
Source
Thrown at app/src/main/java/io/github/muntashirakon/io/fs/VirtualFileSystem.java:127
return new Uri.Builder()
.scheme(SCHEME)
.authority(String.valueOf(fsId))
.path(path != null ? path : File.separator)
.build();
}
@NonNull
private static VirtualFileSystem getNewInstance(@NonNull Path file, @NonNull String type) {
if (ZipFileSystem.TYPE.equals(type)) {
return new ZipFileSystem(file);
}
if (ApkFileSystem.TYPE.equals(type)) {
return new ApkFileSystem(file);
}
if (DexFileSystem.TYPE.equals(type)) {
return new DexFileSystem(file);
}
throw new IllegalArgumentException("Invalid type " + type);
}
private static final SparseArrayCompat<VirtualFileSystem> sFileSystems = new SparseArrayCompat<>(3);
private static final HashMap<Uri, Integer> sUriVfsIdsMap = new HashMap<>(3);
private static final HashMap<Uri, List<Integer>> sParentUriVfsIdsMap = new HashMap<>(3);
@WorkerThread
public static int mount(@NonNull Uri mountPoint, @NonNull Path file, @NonNull String type) throws IOException {
return mount(mountPoint, file, type, new MountOptions.Builder().build());
}
@WorkerThread
public static int mount(@NonNull Uri mountPoint,
@NonNull Path file,
@NonNull String type,
@NonNull MountOptions options)
throws IOException {
return mount(mountPoint, getNewInstance(file, type), options);View on GitHub (pinned to 0152f468fc)
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.
Example fix
// before
new MountOptions().setType("zip");
// after
String type = ApkFileSystem.TYPE; // or DexFileSystem.TYPE
if (!type.equals(ApkFileSystem.TYPE) && !type.equals(DexFileSystem.TYPE)) throw new IllegalArgumentException(type);
new MountOptions().setType(type); Defensive patterns
Strategy: validation
Validate before calling
Set<String> supported = Set.of(ApkFileSystem.TYPE, DexFileSystem.TYPE);
if (!supported.contains(options.getType())) throw new IllegalArgumentException("Unsupported VFS type: " + options.getType()); Try / catch
try {
VirtualFileSystem.mount(mountPoint, options);
} catch (IllegalArgumentException e) {
// fall back to a supported type or report supported types
} Prevention
- 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).
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Couldn't find any writable Obb dir
- Invalid export type: {exportType}
- Could not delete the selected backups
- Could not create package staging directory
- Could not create staging files
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/7c4409814f20eab1.
Report an issue: GitHub.