{"record":{"id":"4c9403849f986f1c","repo":"MuntashirAkon/AppManager","slug":"could-not-get-backup-files-tbconverter","errorCode":null,"errorMessage":"Could not get backup files","messagePattern":"Could not get backup files","errorType":"exception","errorClass":"BackupException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/TBConverter.java","lineNumber":114,"sourceCode":"        int idx = dirtyName.indexOf('-');\n        if (idx == -1) mPackageName = null;\n        else mPackageName = dirtyName.substring(0, idx);\n        mBackupTime = propFile.lastModified();  // TODO: Grab from the file name\n        mFilesToBeDeleted.add(propFile);\n    }\n\n    @Override\n    public void convert() throws BackupException {\n        if (mPackageName == null) {\n            throw new BackupException(\"Could not read package name.\");\n        }\n        // Source metadata\n        mSourceMetadata = readPropFile();\n        // Simulate a backup creation\n        try {\n            mBackupItem = BackupItems.createBackupItemGracefully(mUserId, \"TB\", mPackageName);\n        } catch (IOException e) {\n            throw new BackupException(\"Could not get backup files\", e);\n        }\n        boolean backupSuccess = false;\n        try {\n            try {\n                // Destination metadata\n                mDestMetadata = ConvertUtils.getV5Metadata(mSourceMetadata, mBackupItem);\n                // Destination APK will be renamed\n                mDestMetadata.metadata.apkName = \"base.apk\";\n            } catch (CryptoException e) {\n                throw new BackupException(\"Failed to get crypto \" + mDestMetadata.info.crypto, e);\n            }\n            try {\n                mChecksum = mBackupItem.getChecksum();\n            } catch (IOException e) {\n                throw new BackupException(\"Failed to create checksum file.\", e);\n            }\n            // Backup icon\n            backupIcon();","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/TBConverter.java#L96-L132","documentation":"Thrown by TBConverter.convert() when BackupItems.createBackupItemGracefully throws IOException while setting up the destination backup files/directories for the simulated backup. The destination backup item is the scaffold all converted data is written into, so failure aborts the conversion.","triggerScenarios":"Destination backup root not writable (permissions, scoped storage), path creation failing, insufficient storage to initialize the backup item, or invalid userId/package combination producing an unusable path.","commonSituations":"Backing up to SD card/USB that is read-only or full; Android 11+ scoped-storage restrictions on the chosen backup directory; corrupted prior conversion leftovers blocking directory creation; work-profile/user IDs the storage layer can't resolve.","solutions":["Check the wrapped IOException cause for the exact path that could not be created/opened.","Verify the backup destination directory is writable and has free space; pick internal storage to rule out external-storage restrictions.","Grant AppManager storage / all-files-access permissions on Android 11+.","Delete stale/partial output of previous failed conversions for this package and retry."],"exampleFix":"// before: convert to whatever destination is set\nconverter.convert();\n// after: ensure destination is writable first\nFile dest = getBackupDestDir(userId, packageName);\nif (!dest.canWrite() || dest.getUsableSpace() < MIN_FREE) {\n    throw new IOException(\"destination not writable or full: \" + dest);\n}\nconverter.convert();","handlingStrategy":"validation","validationCode":"File dest = getBackupDestDir(userId, packageName);\nif (!dest.getParentFile().canWrite())\n    throw new IOException(\"backup destination not writable: \" + dest);\nif (dest.getUsableSpace() < MIN_FREE_BYTES)\n    throw new IOException(\"insufficient space: \" + dest);","typeGuard":null,"tryCatchPattern":"try { converter.convert(); }\ncatch (BackupException e) {\n    if (e.getMessage().equals(\"Could not get backup files\")) {\n        // inspect IOException cause; switch destination or free space, then retry\n    }\n}","preventionTips":["Verify destination writability and free space before batch conversions","Grant storage/all-files-access on Android 11+","Clean partial output from earlier failed conversions","Prefer internal storage destinations to avoid removable-media issues"],"tags":["android","backup","io","filesystem"],"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-14T11:17:12.474Z"}