{"record":{"id":"b51887d1d7e9f202","repo":"MuntashirAkon/AppManager","slug":"could-not-move-mtempbackuppath-to-mbackuppath","errorCode":null,"errorMessage":"Could not move <mTempBackupPath> to <mBackupPath>","messagePattern":"Could not move <mTempBackupPath> to <mBackupPath>","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/backup/BackupItems.java","lineNumber":476,"sourceCode":"        public boolean isFrozen() {\n            try {\n                return getFreezeFile().exists();\n            } catch (IOException e) {\n                return false;\n            }\n        }\n\n        public void commit() throws IOException {\n            if (mBackupMode) {\n                if (mBackupSuccess) {\n                    // Backup already done\n                    return;\n                }\n                if (!delete()) {\n                    throw new IOException(\"Could not delete \" + mBackupPath);\n                }\n                if (!mTempBackupPath.moveTo(mBackupPath)) {\n                    throw new IOException(\"Could not move \" + mTempBackupPath + \" to \" + mBackupPath);\n                }\n                if (mPreviousBackups != null) {\n                    for (BackupItem previousBackup : mPreviousBackups) {\n                        if (!previousBackup.delete()) {\n                            Log.w(TAG, \"Could not delete %s\", previousBackup.mBackupPath);\n                        }\n                    }\n                }\n                mBackupSuccess = true;\n                // Set backup mode to false to make it read-only\n                mBackupMode = false;\n            }\n        }\n\n        public void cleanup() {\n            if (mBackupMode) {\n                if (!mBackupSuccess) {\n                    // Backup wasn't successful, delete the directory","sourceCodeStart":458,"sourceCodeEnd":494,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/BackupItems.java#L458-L494","documentation":"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.","triggerScenarios":"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.","commonSituations":"Backups targeting SD card that was unplugged mid-operation, insufficient free space, race with another backup process on the same package.","solutions":["Check free disk space and target mount status, then retry the backup","Ensure the temp and final paths are on the same volume","Re-run the backup; the temp path is recreated","Avoid concurrent backups of the same package"],"exampleFix":"// before\nbackupItem.close(); // may throw \"Could not move ...\"\n// after\ntry {\n    backupItem.close();\n} catch (IOException e) {\n    if (freeSpace < required) { /* free space */ }\n    retryBackup();\n}","handlingStrategy":"retry","validationCode":"// ensure same volume and free space before backup\nlong free = backupDir.getFreeSpace();\nif (free < estimatedBackupSize * 2) { /* free space first */ }","typeGuard":null,"tryCatchPattern":"try {\n    backupItem.close();\n} catch (IOException e) {\n    if (e.getMessage().startsWith(\"Could not move\")) {\n        retryBackupWithBackoff();\n    }\n}","preventionTips":["Keep temp and final backup paths on the same filesystem","Ensure ample free space","Avoid removable storage for backups"],"tags":["android","backup","file-io","move-failed"],"backgroundTag":"file-write-failed","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}