{"record":{"id":"1186bab73520de6e","repo":"MuntashirAkon/AppManager","slug":"packagename","errorCode":null,"errorMessage":"${packageName}","messagePattern":"\\$\\{packageName\\}","errorType":"exception","errorClass":"PackageManager.NameNotFoundException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/compat/DomainVerificationManagerCompat.java","lineNumber":42,"sourceCode":"            return getDomainVerificationManager().getDomainVerificationUserState(packageName, userId);\n        } catch (Throwable ignore) {\n        }\n        return null;\n    }\n\n    @RequiresPermission(ManifestCompat.permission.UPDATE_DOMAIN_VERIFICATION_USER_SELECTION)\n    public static void setDomainVerificationLinkHandlingAllowed(String packageName, boolean allowed, int userId)\n            throws RemoteException, PackageManager.NameNotFoundException {\n        try {\n            getDomainVerificationManager().setDomainVerificationLinkHandlingAllowed(packageName, allowed, userId);\n        } catch (ServiceSpecificException e) {\n            int serviceSpecificErrorCode = e.errorCode;\n            if (packageName == null) {\n                packageName = e.getMessage();\n            }\n\n            if (serviceSpecificErrorCode == 1) {\n                throw new PackageManager.NameNotFoundException(packageName);\n            }\n            throw e;\n        }\n    }\n\n    public static IDomainVerificationManager getDomainVerificationManager() {\n        return IDomainVerificationManager.Stub.asInterface(ProxyBinder.getService(Context.DOMAIN_VERIFICATION_SERVICE));\n    }\n}\n","sourceCodeStart":24,"sourceCodeEnd":52,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/compat/DomainVerificationManagerCompat.java#L24-L52","documentation":"Thrown by setDomainVerificationLinkHandlingAllowed when the Android framework's domain verification service reports errorCode 1, indicating the given package does not exist (or is not visible to the caller) for domain-verification purposes. The compat layer maps that service-specific error to PackageManager.NameNotFoundException, using the package name (or the framework's own message when packageName is null).","triggerScenarios":"Calling setDomainVerificationLinkHandlingAllowed(packageName, userId, allowed) with a packageName that is not installed, has been uninstalled, or is not visible due to package visibility filtering; also when the underlying IDomainVerificationManager call throws an AndroidException with errorCode 1.","commonSituations":"Querying a package right after uninstall; missing <queries> declaration so the package is filtered out on Android 11+; targeting a work-profile user where the package is absent; typos in the package name.","solutions":["Verify the package is installed and visible before calling (pm.getPackageInfo in a try-catch, or getApplicationInfo).","Add a <queries> entry in AndroidManifest.xml so the target package is visible to your app.","Catch PackageManager.NameNotFoundException around the call and handle the missing-package case.","Double-check the userId/packageName pair (e.g. profile user vs main user)."],"exampleFix":"// before\ncompat.setDomainVerificationLinkHandlingAllowed(pkg, userId, true);\n// after\ntry {\n    compat.setDomainVerificationLinkHandlingAllowed(pkg, userId, true);\n} catch (PackageManager.NameNotFoundException e) {\n    // package not installed / not visible; skip or inform user\n}","handlingStrategy":"try-catch","validationCode":"try {\n    pm.getPackageInfoAsUser(packageName, 0, userId);\n} catch (PackageManager.NameNotFoundException e) {\n    // skip domain verification call\n}","typeGuard":"boolean isInstalled(String pkg, int userId) {\n    try { pm.getPackageInfoAsUser(pkg, 0, userId); return true; }\n    catch (PackageManager.NameNotFoundException e) { return false; }\n}","tryCatchPattern":"try {\n    compat.setDomainVerificationLinkHandlingAllowed(pkg, userId, true);\n} catch (PackageManager.NameNotFoundException e) {\n    Log.w(TAG, \"Package not available for domain verification: \" + pkg);\n}","preventionTips":["Check installation/visibility before calling","Declare <queries> entries for target packages","Validate userId (profile vs main)"],"tags":["android","package-not-found","domain-verification"],"backgroundTag":"resource-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"}