{"record":{"id":"9a9420f095559be8","repo":"MuntashirAkon/AppManager","slug":"unknown-package","errorCode":null,"errorMessage":"Unknown package: ...","messagePattern":"Unknown package: \\.\\.\\.","errorType":"exception","errorClass":"RemoteException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/compat/PackageManagerCompat.java","lineNumber":330,"sourceCode":"\n    @SuppressWarnings(\"deprecation\")\n    @NonNull\n    public static InstallSourceInfoCompat getInstallSourceInfo(@NonNull String packageName, @UserIdInt int userId)\n            throws RemoteException {\n        IPackageManager pm = getPackageManager();\n        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {\n            return new InstallSourceInfoCompat(pm.getInstallSourceInfo(packageName, userId));\n        }\n        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {\n            return new InstallSourceInfoCompat(pm.getInstallSourceInfo(packageName));\n        }\n        String installerPackageName = null;\n        try {\n            installerPackageName = getPackageManager().getInstallerPackageName(packageName);\n        } catch (IllegalArgumentException e) {\n            String message = e.getMessage();\n            if (message != null && message.startsWith(\"Unknown package:\")) {\n                throw new RemoteException(message);\n            }\n        }\n        return new InstallSourceInfoCompat(installerPackageName);\n    }\n\n    @Nullable\n    public static Intent getLaunchIntentForPackage(@NonNull String packageName, @UserIdInt int userId) {\n        Context context = ContextUtils.getContext();\n        if (userId == UserHandleHidden.myUserId()) {\n            PackageManager pm = context.getPackageManager();\n            return Utils.isTv(context)\n                    ? pm.getLeanbackLaunchIntentForPackage(packageName)\n                    : pm.getLaunchIntentForPackage(packageName);\n        }\n        UserHandle userHandle = Users.getUserHandle(userId);\n        if (userHandle == null) {\n            // No supported user present\n            return null;","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/compat/PackageManagerCompat.java#L312-L348","documentation":"getInstallSourceInfo fetches the installer package name via IPackageManager. For unknown packages the framework throws IllegalArgumentException whose message starts with \"Unknown package:\"; the compat layer rethrows it as a RemoteException carrying the original message so callers can distinguish it from other failures.","triggerScenarios":"Calling getInstallSourceInfo(packageName) for a package that is not installed (or not known to the system server), causing the underlying binder call to throw IllegalArgumentException(\"Unknown package: ...\").","commonSituations":"Checking install source right after uninstall; malformed/typo package names; querying packages from another profile where they don't exist.","solutions":["Catch RemoteException around getInstallSourceInfo and treat it as package-not-found.","Validate the package is installed before querying its install source.","Parse the message (startsWith \"Unknown package:\") if you need to distinguish this case.","Use getInstalledPackages to build the set of valid package names first."],"exampleFix":"// before\nInstallSourceInfoCompat src = PackageManagerCompat.getInstallSourceInfo(pkg);\n// after\nInstallSourceInfoCompat src;\ntry {\n    src = PackageManagerCompat.getInstallSourceInfo(pkg);\n} catch (RemoteException e) {\n    src = null; // unknown package\n}","handlingStrategy":"try-catch","validationCode":"boolean known;\ntry { pm.getPackageInfoAsUser(pkg, 0, userId); known = true; }\ncatch (PackageManager.NameNotFoundException e) { known = false; }","typeGuard":null,"tryCatchPattern":"try {\n    InstallSourceInfoCompat src = PackageManagerCompat.getInstallSourceInfo(pkg);\n} catch (RemoteException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Unknown package:\")) {\n        // handle unknown package\n    }\n}","preventionTips":["Query install source only for installed packages","Distinguish RemoteException messages by prefix","Keep a cached set of installed package names"],"tags":["android","package-not-found","remote-exception"],"backgroundTag":"record-not-found","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"}