{"record":{"id":"1b1a26de1fc50fe3","repo":"MuntashirAkon/AppManager","slug":"could-not-finalise-backup-oabconverter","errorCode":null,"errorMessage":"Could not finalise backup.","messagePattern":"Could not finalise backup\\.","errorType":"exception","errorClass":"BackupException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/OABConverter.java","lineNumber":159,"sourceCode":"                for (Map.Entry<String, String> filenameChecksumPair : filenameChecksumMap.entrySet()) {\n                    mChecksum.add(filenameChecksumPair.getKey(), filenameChecksumPair.getValue());\n                }\n            } catch (IOException e) {\n                throw new BackupException(\"Failed to write metadata.\", e);\n            }\n            // Store checksum for metadata\n            mChecksum.close();\n            // Encrypt checksum\n            try {\n                mBackupItem.encrypt(new Path[]{mChecksum.getFile()});\n            } catch (IOException e) {\n                throw new BackupException(\"Failed to encrypt checksums.txt\", e);\n            }\n            // Replace current backup\n            try {\n                mBackupItem.commit();\n            } catch (IOException e) {\n                throw new BackupException(\"Could not finalise backup.\", e);\n            }\n            backupSuccess = true;\n        } catch (BackupException e) {\n            throw e;\n        } catch (Throwable th) {\n            throw new BackupException(\"Unknown error occurred.\", th);\n        } finally {\n            mBackupItem.cleanup();\n            if (backupSuccess) {\n                BackupUtils.putBackupToDbAndBroadcast(ContextUtils.getContext(), mDestMetadata);\n            }\n        }\n    }\n\n    @Override\n    public void cleanup() {\n        mSourceCrypto.close();\n        mBackupLocation.delete();","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/OABConverter.java#L141-L177","documentation":"Finally, mBackupItem.commit() finalises the backup (renames staging into place, etc.). An IOException there means the backup could not be committed, wrapped as BackupException(\"Could not finalise backup.\"). Without a successful commit the backup remains incomplete.","triggerScenarios":"BackupItem.commit() throws IOException — staging directory cannot be renamed/moved to the final backup path, target already exists in a bad state, or filesystem error.","commonSituations":"Target backup name collision; storage unmounted mid-operation; leftover partial backup from a previous failed run blocking commit.","solutions":["Delete any leftover partial backup directory with the same name and retry","Verify storage is mounted and writable during commit","Check getCause() IOException for the exact filesystem error","Retry the conversion with sufficient free space"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"File target = new File(backupDir, packageName);\nif (target.exists()) {\n    // remove stale partial backup so commit() can succeed\n    Utils.deleteDir(target);\n}","typeGuard":null,"tryCatchPattern":"try {\n    converter.convert();\n} catch (BackupException e) {\n    if (\"Could not finalise backup.\".equals(e.getMessage())) {\n        // clean partial backup dir and retry\n    }\n}","preventionTips":["Clean up leftover partial backups before retrying","Keep storage mounted during the whole conversion","Ensure unique target names per package/user"],"tags":["backup","commit","io","migration"],"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-23T08:17:48.524Z"}