MuntashirAkon/AppManager · error · NotMountedException

Not mounted

Error message

Not mounted

What it means

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.

Source

Thrown at app/src/main/java/io/github/muntashirakon/io/fs/VirtualFileSystem.java:564

    /**
     * Instructions to execute to unmount the file system. Example operations include cleaning up trees, saving
     * changes, closing resources.
     *
     * @return The final cached file if the file system support modification, {@code null} otherwise.
     */
    @Nullable
    protected abstract File onUnmount(@NonNull Map<String, List<Action>> actions) throws IOException;

    /**
     * Instructions to execute after unmounting the file system.
     */
    protected void onUnmounted() {
    }

    protected void checkMounted() {
        synchronized (sLock) {
            if (mFsId == 0) {
                throw new NotMountedException("Not mounted");
            }
        }
    }

    /* File APIs */
    private void addAction(@NonNull String path, @NonNull Action action) {
        synchronized (mActions) {
            List<Action> actionSet = mActions.get(path);
            if (actionSet == null) {
                actionSet = new ArrayList<>();
                mActions.put(path, actionSet);
            }
            actionSet.add(action);
        }
    }

    @Nullable
    protected abstract Node<?> getNode(String path);

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Mount the filesystem before use (VirtualFileSystem.mount with valid options) and use the returned/mounted instance.
  2. Re-mount if the instance was unmounted, obtaining fresh nodes afterward.
  3. Check isMounted()/fsId state (or catch NotMountedException) before file operations in long-lived code.
  4. Synchronize unmount/use so a concurrent unmount doesn't invalidate in-flight operations.

Example fix

// before
vfs.listFiles(path);
// after
if (!vfs.isMounted()) vfs = VirtualFileSystem.mount(mountPoint, options);
vfs.listFiles(path);
Defensive patterns

Strategy: try-catch

Validate before calling

if (!vfs.isMounted()) throw new IllegalStateException("Mount before use");

Type guard

static boolean usable(VirtualFileSystem vfs) { return vfs != null && vfs.isMounted(); }

Try / catch

try {
    vfs.doFileOp(path);
} catch (NotMountedException e) {
    vfs = VirtualFileSystem.mount(mountPoint, options);
    vfs.doFileOp(path);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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().

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12). Data as JSON: /api/errors/4165a94440d6a9a1. Report an issue: GitHub.