MuntashirAkon/AppManager · error · BackupException

Could not read package name.

Error message

Could not read package name.

What it means

Thrown by TBConverter.convert() when mPackageName is null at conversion start. The Titanium Backup converter requires the target package name to locate the source backup folder and create the destination backup item, so a null name makes conversion impossible.

Source

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

     *
     * @param propFile Location to the properties file e.g. {@code /sdcard/TitaniumBackup/package.name-YYYYMMDD-HHMMSS.properties}
     */
    public TBConverter(@NonNull Path propFile) {
        mPropFile = propFile;
        mBackupLocation = propFile.getParent();
        mUserId = UserHandleHidden.myUserId();
        String dirtyName = propFile.getName();
        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);

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Pass a non-null package name when constructing TBConverter, or ensure the source folder name follows the Titanium Backup 'packageName-date' convention so it can be parsed.
  2. Validate the package name before calling convert(): if (packageName == null) fail early with a clear message.
  3. Rename the Titanium Backup folder to the standard format and re-run conversion.
  4. Check the caller (e.g., conversion UI) isn't losing the selected package name due to an intent/selection bug.

Example fix

// before
new TBConverter(userId, null, sourceDir).convert();
// after
String pkg = parsePackageFromFolderName(sourceDir.getName());
Objects.requireNonNull(pkg, "cannot derive package from " + sourceDir);
new TBConverter(userId, pkg, sourceDir).convert();
Defensive patterns

Strategy: validation

Validate before calling

Objects.requireNonNull(packageName, "package name required for TB conversion");
if (!packageName.matches("[A-Za-z][A-Za-z0-9_]*(\\.[A-Za-z][A-Za-z0-9_]*)+"))
    throw new IllegalArgumentException("not a valid package name: " + packageName);

Try / catch

try { converter.convert(); }
catch (BackupException e) {
    if (e.getMessage().equals("Could not read package name.")) {
        // folder name didn't parse; prompt user to pick the package manually
    }
}

Prevention

When it happens

Trigger: Constructing TBConverter without supplying a package name (constructor argument missing or resolved from a folder name that could not be parsed), then calling convert(); converters invoked from code paths that don't validate the package identifier first.

Common situations: Titanium Backup folders whose naming convention ('com.example.app-YYYYMMDD...') doesn't match the parser's expectations, e.g., folders renamed by the user or created by non-standard tools; programmatic use passing null instead of the folder-derived name.

Related errors


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