MuntashirAkon/AppManager · error · BackupException

Unknown error occurred.

Error message

Unknown error occurred.

What it means

SBConverter.convert's catch-all converts any Throwable that is not already a BackupException into BackupException('Unknown error occurred.', th). It guarantees callers always receive a BackupException from convert, while the cause retains the original unexpected failure (NPE, ClassCastException, RuntimeException, Error, etc.).

Solutions

  1. Inspect the cause (th) stack trace — the message is intentionally generic
  2. Check that all converter fields (mBackupItem, mDestMetadata, mChecksum, mCachedApk) are initialized before use
  3. Re-run with debug logging to find which conversion stage threw
  4. Report/fix the underlying bug; this catch-all indicates an unanticipated failure path
Defensive patterns

Strategy: try-catch

Validate before calling

// guard converter state before calling convert
if (packageName == null || userId < 0) {
    throw new IllegalArgumentException("packageName and userId must be set before conversion");
}

Try / catch

try {
    converter.convert(...);
} catch (BackupException e) {
    Throwable root = e.getCause();
    if (root != null) {
        Log.e(TAG, "Conversion failed with unexpected error", root);
    }
}

Prevention

When it happens

Trigger: Any unexpected Throwable inside the conversion pipeline not covered by the specific IOException/CryptoException handlers — e.g. NullPointerException on uninitialized fields (mBackupItem, mDestMetadata), ClassCastException, or runtime errors from metadata/icon/APK backup helpers.

Common situations: Programming errors in converter state (fields used before assignment), unexpected nulls from parsed source metadata, library bugs, or OOM/other Errors during large APK backups.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/SBConverter.java:153

            }
            mChecksum.close();
            // Encrypt checksum
            try {
                mBackupItem.encrypt(new Path[]{mChecksum.getFile()});
            } catch (IOException e) {
                throw new BackupException("Failed to encrypt checksums.txt");
            }
            // Replace current backup
            try {
                mBackupItem.commit();
            } catch (IOException e) {
                throw new BackupException("Could not finalise backup.", e);
            }
            backupSuccess = true;
        } catch (BackupException e) {
            throw e;
        } catch (Throwable th) {
            throw new BackupException("Unknown error occurred.", th);
        } finally {
            mBackupItem.cleanup();
            mCachedApk.requireParent().delete();
            if (backupSuccess) {
                BackupUtils.putBackupToDbAndBroadcast(ContextUtils.getContext(), mDestMetadata);
            }
        }
    }

    @Override
    public void cleanup() {
        for (Path file : mFilesToBeDeleted) {
            file.delete();
        }
    }

    private void backupApkFile() throws BackupException {
        Path sourceDir = mCachedApk.requireParent();

View on GitHub (pinned to 0152f468fc)