MuntashirAkon/AppManager · error · BackupException

Apparently the install wasn't complete in the previous secti

Error message

Apparently the install wasn't complete in the previous section.

What it means

After installing the APKs, restoreApkFiles re-queries PackageManagerCompat.getPackageInfo to confirm the package is now installed and to capture its UID. This error means the package could not be found even though installation was just attempted — i.e. the previous install step did not actually complete. AppManager throws this to signal an inconsistent restore state.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/RestoreOp.java:406

                    } else {
                        statusMessage = "Couldn't perform an installation";
                    }
                    if (status.get() != null) {
                        statusMessage += ": " + status.get();
                    } else statusMessage += ".";
                    throw new BackupException(statusMessage);
                }
            } finally {
                deleteFiles(allApks);  // Clean up apk files
            }
            // Get package info, again
            try {
                mPackageInfo = PackageManagerCompat.getPackageInfo(mPackageName, GET_SIGNING_CERTIFICATES
                        | PackageManagerCompat.MATCH_STATIC_SHARED_AND_SDK_LIBRARIES, mUserId);
                mUid = Objects.requireNonNull(mPackageInfo.applicationInfo).uid;
                mIsInstalled = true;
            } catch (Exception e) {
                throw new BackupException("Apparently the install wasn't complete in the previous section.", e);
            }
        }
    }

    private void restoreKeyStore() throws BackupException {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
            // keystore v2 is not supported.
            Log.w(TAG, "Ignoring KeyStore backups for %s", mPackageName);
            return;
        }
        if (mPackageInfo == null) {
            throw new BackupException("KeyStore restore is requested but the app isn't installed.");
        }
        Path[] keyStoreFiles = mBackupItem.getKeyStoreFiles();
        if (keyStoreFiles.length == 0) {
            throw new BackupException("KeyStore files should've existed but they didn't");
        }
        if (!mRequestedFlags.skipSignatureCheck()) {

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Check logs from the install step (error 123 family) — fix the underlying installation failure first.
  2. Verify mUserId matches the user the package was installed into.
  3. Re-run the full restore; do not attempt KeyStore/data restore for a package that is not installed.
  4. Confirm the package name in backup metadata matches the APK's actual package.
Defensive patterns

Strategy: validation

Validate before calling

try { pm.getPackageInfo(pkg, GET_SIGNING_CERTIFICATES | MATCH_STATIC_SHARED_AND_SDK_LIBRARIES, userId); } catch (Exception e) { /* package absent — do not proceed with data/keystore restore */ }

Type guard

boolean isInstalled(PackageInfo pi) { return pi != null && pi.applicationInfo != null; }

Try / catch

try { mPackageInfo = PackageManagerCompat.getPackageInfo(...); } catch (Exception e) { throw new BackupException("Apparently the install wasn't complete in the previous section.", e); }

Prevention

When it happens

Trigger: getPackageInfo(mPackageName, GET_SIGNING_CERTIFICATES | MATCH_STATIC_SHARED_AND_SDK_LIBRARIES, mUserId) throws because the package is absent from the given user, immediately after the install call reported success or was skipped.

Common situations: The install in the previous section failed silently or was staged but never committed; installation targeted a different user than mUserId; the device removed the package between install and lookup; hidden/suspended package lookups failing on some OEM ROMs.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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