{"record":{"id":"c2e8427d0f8e0430","repo":"MuntashirAkon/AppManager","slug":"failed-to-encrypt-checksums-txt","errorCode":null,"errorMessage":"Failed to encrypt checksums.txt","messagePattern":"Failed to encrypt checksums\\.txt","errorType":"exception","errorClass":"BackupException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/OABConverter.java","lineNumber":153,"sourceCode":"            if (mDestMetadata.info.flags.backupData()) {\n                backupData();\n            }\n            // Write modified metadata\n            try {\n                Map<String, String> filenameChecksumMap = MetadataManager.writeMetadata(mDestMetadata, mBackupItem);\n                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        }","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/OABConverter.java#L135-L171","documentation":"As the last content step, the converter encrypts checksums.txt via mBackupItem.encrypt(new Path[]{mChecksum.getFile()}). An IOException during encryption becomes BackupException(\"Failed to encrypt checksums.txt\").","triggerScenarios":"BackupItem.encrypt() fails on the checksum file — crypto stream setup failure, missing encryption key, or I/O error writing the encrypted output.","commonSituations":"Encrypted backup mode selected but keys misconfigured; storage full when writing encrypted copy; crypto scheme mismatch between metadata and configured keys.","solutions":["Verify encryption keys/configuration match metadata.info.crypto","Ensure enough free space for the encrypted copy of checksums.txt","Check the wrapped IOException cause for the root failure","Disable encryption (crypto = null) if encrypted backups are not required"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (metadata.crypto != null && !isCryptoConfigured(metadata.crypto)) {\n    throw new IllegalStateException(\"Encryption keys unavailable for \" + metadata.crypto);\n}","typeGuard":null,"tryCatchPattern":"try {\n    converter.convert();\n} catch (BackupException e) {\n    if (\"Failed to encrypt checksums.txt\".equals(e.getMessage())) {\n        // fix crypto config or disable encryption, then retry\n    }\n}","preventionTips":["Validate crypto configuration before starting conversion","Ensure free space for encrypted artifacts","Match crypto scheme with configured keys"],"tags":["backup","encryption","checksum","crypto"],"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"}