{"record":{"id":"4165a94440d6a9a1","repo":"MuntashirAkon/AppManager","slug":"not-mounted","errorCode":null,"errorMessage":"Not mounted","messagePattern":"Not mounted","errorType":"exception","errorClass":"NotMountedException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/io/fs/VirtualFileSystem.java","lineNumber":564,"sourceCode":"    /**\n     * Instructions to execute to unmount the file system. Example operations include cleaning up trees, saving\n     * changes, closing resources.\n     *\n     * @return The final cached file if the file system support modification, {@code null} otherwise.\n     */\n    @Nullable\n    protected abstract File onUnmount(@NonNull Map<String, List<Action>> actions) throws IOException;\n\n    /**\n     * Instructions to execute after unmounting the file system.\n     */\n    protected void onUnmounted() {\n    }\n\n    protected void checkMounted() {\n        synchronized (sLock) {\n            if (mFsId == 0) {\n                throw new NotMountedException(\"Not mounted\");\n            }\n        }\n    }\n\n    /* File APIs */\n    private void addAction(@NonNull String path, @NonNull Action action) {\n        synchronized (mActions) {\n            List<Action> actionSet = mActions.get(path);\n            if (actionSet == null) {\n                actionSet = new ArrayList<>();\n                mActions.put(path, actionSet);\n            }\n            actionSet.add(action);\n        }\n    }\n\n    @Nullable\n    protected abstract Node<?> getNode(String path);","sourceCodeStart":546,"sourceCodeEnd":582,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/io/fs/VirtualFileSystem.java#L546-L582","documentation":"VirtualFileSystem.checkMounted throws NotMountedException(\"Not mounted\") whenever a filesystem API is used while the instance's mFsId is 0, i.e. the filesystem was never mounted or has been unmounted. It is an internal state guard protecting all file operations on a VFS instance.","triggerScenarios":"Calling any file API (newInputStream, listFiles, delete, etc.) on a VirtualFileSystem instance obtained but never mounted, or after unmount(); using a stale instance captured before unmount; two threads where one unmounts while another still uses the instance.","commonSituations":"Holding a VFS reference across a settings change that unmounted it; calling APIs after unmount in cleanup code that still touches the object; constructing an instance directly instead of via mount().","solutions":["Mount the filesystem before use (VirtualFileSystem.mount with valid options) and use the returned/mounted instance.","Re-mount if the instance was unmounted, obtaining fresh nodes afterward.","Check isMounted()/fsId state (or catch NotMountedException) before file operations in long-lived code.","Synchronize unmount/use so a concurrent unmount doesn't invalidate in-flight operations."],"exampleFix":"// before\nvfs.listFiles(path);\n// after\nif (!vfs.isMounted()) vfs = VirtualFileSystem.mount(mountPoint, options);\nvfs.listFiles(path);","handlingStrategy":"try-catch","validationCode":"if (!vfs.isMounted()) throw new IllegalStateException(\"Mount before use\");","typeGuard":"static boolean usable(VirtualFileSystem vfs) { return vfs != null && vfs.isMounted(); }","tryCatchPattern":"try {\n    vfs.doFileOp(path);\n} catch (NotMountedException e) {\n    vfs = VirtualFileSystem.mount(mountPoint, options);\n    vfs.doFileOp(path);\n}","preventionTips":["Acquire VFS instances only through mount(), never keep raw instances across unmounts.","Re-validate mounted state after lifecycle events (config change, cleanup).","Synchronize unmount and use paths to avoid races."],"tags":["filesystem","lifecycle","not-mounted","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-14T11:17:12.474Z"}