MuntashirAkon/AppManager · error · IOException

Could not move <mTempBackupPath> to <mBackupPath>

Error message

Could not move <mTempBackupPath> to <mBackupPath>

What it means

BackupItem.finalize promotes a completed backup by moving mTempBackupPath to mBackupPath after clearing the old backup. If the move fails it throws, indicating the finished temp backup could not be committed to its final location.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/BackupItems.java:476

        public boolean isFrozen() {
            try {
                return getFreezeFile().exists();
            } catch (IOException e) {
                return false;
            }
        }

        public void commit() throws IOException {
            if (mBackupMode) {
                if (mBackupSuccess) {
                    // Backup already done
                    return;
                }
                if (!delete()) {
                    throw new IOException("Could not delete " + mBackupPath);
                }
                if (!mTempBackupPath.moveTo(mBackupPath)) {
                    throw new IOException("Could not move " + mTempBackupPath + " to " + mBackupPath);
                }
                if (mPreviousBackups != null) {
                    for (BackupItem previousBackup : mPreviousBackups) {
                        if (!previousBackup.delete()) {
                            Log.w(TAG, "Could not delete %s", previousBackup.mBackupPath);
                        }
                    }
                }
                mBackupSuccess = true;
                // Set backup mode to false to make it read-only
                mBackupMode = false;
            }
        }

        public void cleanup() {
            if (mBackupMode) {
                if (!mBackupSuccess) {
                    // Backup wasn't successful, delete the directory

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Check free disk space and target mount status, then retry the backup
  2. Ensure the temp and final paths are on the same volume
  3. Re-run the backup; the temp path is recreated
  4. Avoid concurrent backups of the same package

Example fix

// before
backupItem.close(); // may throw "Could not move ..."
// after
try {
    backupItem.close();
} catch (IOException e) {
    if (freeSpace < required) { /* free space */ }
    retryBackup();
}
Defensive patterns

Strategy: retry

Validate before calling

// ensure same volume and free space before backup
long free = backupDir.getFreeSpace();
if (free < estimatedBackupSize * 2) { /* free space first */ }

Try / catch

try {
    backupItem.close();
} catch (IOException e) {
    if (e.getMessage().startsWith("Could not move")) {
        retryBackupWithBackoff();
    }
}

Prevention

When it happens

Trigger: Closing a BackupItem in backup mode where delete() of the old backup succeeded but Path.moveTo(temp, final) returned false — e.g. cross-device move, target dir vanished, out-of-space.

Common situations: Backups targeting SD card that was unplugged mid-operation, insufficient free space, race with another backup process on the same package.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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