MuntashirAkon/AppManager · error · BackupException

Could not get backup files

Error message

Could not get backup files

What it means

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.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/TBConverter.java:114

        int idx = dirtyName.indexOf('-');
        if (idx == -1) mPackageName = null;
        else mPackageName = dirtyName.substring(0, idx);
        mBackupTime = propFile.lastModified();  // TODO: Grab from the file name
        mFilesToBeDeleted.add(propFile);
    }

    @Override
    public void convert() throws BackupException {
        if (mPackageName == null) {
            throw new BackupException("Could not read package name.");
        }
        // Source metadata
        mSourceMetadata = readPropFile();
        // Simulate a backup creation
        try {
            mBackupItem = BackupItems.createBackupItemGracefully(mUserId, "TB", mPackageName);
        } catch (IOException e) {
            throw new BackupException("Could not get backup files", e);
        }
        boolean backupSuccess = false;
        try {
            try {
                // Destination metadata
                mDestMetadata = ConvertUtils.getV5Metadata(mSourceMetadata, mBackupItem);
                // Destination APK will be renamed
                mDestMetadata.metadata.apkName = "base.apk";
            } catch (CryptoException e) {
                throw new BackupException("Failed to get crypto " + mDestMetadata.info.crypto, e);
            }
            try {
                mChecksum = mBackupItem.getChecksum();
            } catch (IOException e) {
                throw new BackupException("Failed to create checksum file.", e);
            }
            // Backup icon
            backupIcon();

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Check the wrapped IOException cause for the exact path that could not be created/opened.
  2. Verify the backup destination directory is writable and has free space; pick internal storage to rule out external-storage restrictions.
  3. Grant AppManager storage / all-files-access permissions on Android 11+.
  4. Delete stale/partial output of previous failed conversions for this package and retry.

Example fix

// before: convert to whatever destination is set
converter.convert();
// after: ensure destination is writable first
File dest = getBackupDestDir(userId, packageName);
if (!dest.canWrite() || dest.getUsableSpace() < MIN_FREE) {
    throw new IOException("destination not writable or full: " + dest);
}
converter.convert();
Defensive patterns

Strategy: validation

Validate before calling

File dest = getBackupDestDir(userId, packageName);
if (!dest.getParentFile().canWrite())
    throw new IOException("backup destination not writable: " + dest);
if (dest.getUsableSpace() < MIN_FREE_BYTES)
    throw new IOException("insufficient space: " + dest);

Try / catch

try { converter.convert(); }
catch (BackupException e) {
    if (e.getMessage().equals("Could not get backup files")) {
        // inspect IOException cause; switch destination or free space, then retry
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12). Data as JSON: /api/errors/4c9403849f986f1c. Report an issue: GitHub.