{"record":{"id":"615288b6cdf69467","repo":"MuntashirAkon/AppManager","slug":"destination-is-a-mount-point","errorCode":null,"errorMessage":"Destination is a mount point.","messagePattern":"Destination is a mount point\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/io/PathImpl.java","lineNumber":1381,"sourceCode":"        return documentFile;\n    }\n\n    @Nullable\n    private static DocumentFile resolveFileOrNull(@NonNull DocumentFile documentFile) {\n        DocumentFile realDocumentFile = getRealDocumentFile(documentFile);\n        if (!realDocumentFile.isDirectory()) {\n            return realDocumentFile;\n        }\n        // Try original\n        if (!documentFile.isDirectory()) {\n            return documentFile;\n        }\n        return null;\n    }\n\n    private static void checkVfs(Uri uri) throws IOException {\n        if (VirtualFileSystem.getFileSystem(uri) != null) {\n            throw new IOException(\"Destination is a mount point.\");\n        }\n    }\n\n    private static boolean isDocumentsProvider(@NonNull Context context, @Nullable String authority) {\n        final Intent intent = new Intent(DocumentsContract.PROVIDER_INTERFACE);\n        final List<ResolveInfo> infos = context.getPackageManager().queryIntentContentProviders(intent, 0);\n        for (ResolveInfo info : infos) {\n            if (Objects.equals(authority, info.providerInfo.authority)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private static class ProxyStorageCallback extends StorageManagerCompat.ProxyFileDescriptorCallbackCompat {\n        @NonNull\n        private final FileChannel mChannel;\n","sourceCodeStart":1363,"sourceCodeEnd":1399,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/io/PathImpl.java#L1363-L1399","documentation":"Thrown by PathImpl.checkVfs when a copy/move destination resolves to an active VirtualFileSystem mount point in this library. Mount points are special nodes backed by a mounted filesystem (APK/DEX), so writing through them would corrupt or shadow the mount. The operation is aborted with a plain IOException.","triggerScenarios":"Calling Path copy/move (or any PathImpl API that calls checkVfs) with a destination Uri for which VirtualFileSystem.getFileSystem(uri) != null, i.e. the Uri is currently registered as a mount point; performing the operation without unmounting first.","commonSituations":"Users of IO/PathUtils try to extract or overwrite files directly onto a mounted APK/DEX mount point (e.g. copying a file onto /mnt/apk/... style path); remount flows that forgot the remount flag; stale mounts left over from a previous session.","solutions":["Choose a destination path that is not a mount point (write next to it, not onto it).","Unmount the filesystem at the destination first with VirtualFileSystem.unmount(mountPoint) (or its Uri-based API), then retry the operation.","If replacing a mount is intended, use the remount option/flag instead of a plain mount/copy.","Before the operation, check VirtualFileSystem.getFileSystem(destUri) != null and route accordingly."],"exampleFix":"// before\nnewPath.copy(destinationMountPoint, StandardCopyOption.REPLACE_EXISTING);\n// after\nif (VirtualFileSystem.getFileSystem(destinationMountPoint.getUri()) != null) {\n    VirtualFileSystem.unmount(destinationMountPoint.getUri());\n}\nnewPath.copy(destinationMountPoint, StandardCopyOption.REPLACE_EXISTING);","handlingStrategy":"validation","validationCode":"if (VirtualFileSystem.getFileSystem(destUri) != null) {\n    throw new IllegalArgumentException(\"Destination is a mount point: \" + destUri);\n}","typeGuard":null,"tryCatchPattern":"try {\n    src.copy(dest);\n} catch (IOException e) {\n    if (\"Destination is a mount point.\".equals(e.getMessage())) {\n        VirtualFileSystem.unmount(dest.getUri());\n        src.copy(dest);\n    } else throw e;\n}","preventionTips":["Check VirtualFileSystem.getFileSystem() on any user-chosen destination before writing.","Maintain a registry of active mount points in app UI so users can't pick them as destinations.","Unmount mounts deterministically when the feature using them closes."],"tags":["filesystem","mount-point","android"],"backgroundTag":"invalid-state-transition","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"}