MuntashirAkon/AppManager · error · IllegalArgumentException
Invalid format: isGranted not found
Error message
Invalid format: isGranted not found
What it means
PermissionRule's constructor reads the isGranted boolean (and optionally flags) from the flattened rule string. If the isGranted token is absent, it throws this IllegalArgumentException; note that a missing flags token is tolerated for backward compatibility, but isGranted is mandatory.
Solutions
- Add the "true"/"false" isGranted token after the permission name in the rule string
- Validate that at least one token remains before constructing PermissionRule
- Re-export rules with the current AppManager version
- Catch IllegalArgumentException per-line during import and skip bad entries
Example fix
// before
new PermissionRule(pkg, "android.permission.CAMERA", new StringTokenizer("com.example\tandroid.permission.CAMERA")); // throws
// after
new PermissionRule(pkg, "android.permission.CAMERA", new StringTokenizer("com.example\tandroid.permission.CAMERA\ttrue\t0")); Defensive patterns
Strategy: validation
Validate before calling
String[] p = line.split("\t");
if (p.length < 3) throw new IllegalArgumentException("PERMISSION rule needs isGranted (flags optional)");
Boolean.parseBoolean(p[2]); Type guard
boolean isParsablePermissionRule(String line) { String[] p = line.split("\t"); return p.length >= 3 && (p[2].equals("true") || p[2].equals("false")) && (p.length < 4 || p[3].matches("\\d+")); } Try / catch
try { new PermissionRule(pkg, perm, tokenizer); } catch (IllegalArgumentException e) { importer.report(line, e); } Prevention
- Remember isGranted is mandatory while flags is optional — never omit isGranted
- Validate the boolean token before parsing
- Diff your rules file against a fresh export to spot missing fields
When it happens
Trigger: new PermissionRule(packageName, permName, tokenizer) invoked when the tokenizer has no token left after the permission name, i.e. the flattened PERMISSION rule line ends right after the permission.
Common situations: Old or hand-edited rules files lacking the isGranted field, truncated imports, or delimiter mistakes dropping the boolean token (while the missing trailing flags would have been fine).
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Invalid format: freeze_type not found
- Invalid format: isGranted not found
- Invalid format: isHidden not found
- Invalid format: isHidden not found
- Invalid format: name not found
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/da846df4893007f0.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/rules/struct/PermissionRule.java:43
private boolean mIsGranted;
@PermissionCompat.PermissionFlags
private int mFlags;
public PermissionRule(@NonNull String packageName, @NonNull String permName, boolean isGranted,
@PermissionCompat.PermissionFlags int flags) {
super(packageName, permName, RuleType.PERMISSION);
mIsGranted = isGranted;
mFlags = flags;
mAppOp = AppOpsManagerCompat.permissionToOpCode(name);
}
public PermissionRule(@NonNull String packageName, @NonNull String permName, @NonNull StringTokenizer tokenizer)
throws IllegalArgumentException {
super(packageName, permName, RuleType.PERMISSION);
if (tokenizer.hasMoreElements()) {
mIsGranted = Boolean.parseBoolean(tokenizer.nextElement().toString());
} else throw new IllegalArgumentException("Invalid format: isGranted not found");
if (tokenizer.hasMoreElements()) {
mFlags = Integer.parseInt(tokenizer.nextElement().toString());
} else {
// Don't throw exception in order to provide backward compatibility
mFlags = 0;
}
mAppOp = AppOpsManagerCompat.permissionToOpCode(name);
}
public boolean isGranted() {
return mIsGranted;
}
public void setGranted(boolean granted) {
mIsGranted = granted;
}
@PermissionCompat.PermissionFlagsView on GitHub (pinned to 0152f468fc)