{"record":{"id":"79a5522a2550d515","repo":"MuntashirAkon/AppManager","slug":"could-not-get-backup-files-sbconverter","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/SBConverter.java","lineNumber":104,"sourceCode":"        mUserId = UserHandleHidden.myUserId();\n        mPm = ContextUtils.getContext().getPackageManager();\n        mFilesToBeDeleted.add(xmlFile);\n    }\n\n    @Override\n    public String getPackageName() {\n        return mPackageName;\n    }\n\n    @Override\n    public void convert() throws BackupException {\n        // Source metadata\n        BackupMetadataV2 sourceMetadata = generateMetadata();\n        // Simulate a backup creation\n        try {\n            mBackupItem = BackupItems.createBackupItemGracefully(mUserId, \"SB\", 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(sourceMetadata, mBackupItem);\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();\n            if (mDestMetadata.info.flags.backupApkFiles()) {\n                backupApkFile();","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/SBConverter.java#L86-L122","documentation":"SBConverter.convert throws BackupException('Could not get backup files.') when BackupItems.createBackupItemGracefully throws IOException, i.e. the destination backup directory/files for the 'SB'-converted package could not be created or opened. Without a BackupItem the whole conversion cannot proceed.","triggerScenarios":"createBackupItemGracefully fails because the backup location is unwritable, storage is full, the user id/package name yields an invalid path, or an I/O error occurs creating backup files.","commonSituations":"Tests or conversions running against read-only storage; external storage not mounted; conflicting permissions on the backup directory in Android scoped storage.","solutions":["Check that the backup destination directory exists and is writable","Ensure device storage has enough free space","Verify the supplied userId and packageName form a valid path","Inspect the wrapped IOException cause for the exact filesystem error"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"File backupRoot = BackupUtils.getBackupDirectory(ContextUtils.getContext());\nif (backupRoot == null || !backupRoot.canWrite() || backupRoot.getUsableSpace() < MIN_FREE_BYTES) {\n    throw new IOException(\"Backup destination unavailable or full\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    converter.convert(...);\n} catch (BackupException e) {\n    if (\"Could not get backup files.\".equals(e.getMessage())) {\n        // check storage/permissions, then retry\n    }\n}","preventionTips":["Verify backup directory writability and free space before converting","Handle Android scoped-storage permissions","Use valid userId/packageName values to keep generated paths valid"],"tags":["android","backup","filesystem","io"],"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"}