MuntashirAkon/AppManager · error · IllegalArgumentException
Invalid format: entryType not found
Error message
Invalid format: entryType not found
What it means
unflattenFromString requires at least three tokens: optional package name (external), entry name, and entry type. When the StringTokenizer is exhausted before the type token, the parser throws IllegalArgumentException("Invalid format: entryType not found"). It protects downstream RuleType.valueOf from a null/absent value.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/rules/struct/RuleEntry.java:86
}
} else throw new IllegalArgumentException("Invalid format: packageName not found for external rule.");
}
if (packageName == null) {
// packageName can't be empty
throw new IllegalArgumentException("Package name cannot be empty.");
}
String name;
RuleType type;
if (tokenizer.hasMoreElements()) {
name = tokenizer.nextElement().toString();
} else throw new IllegalArgumentException("Invalid format: name not found");
if (tokenizer.hasMoreElements()) {
try {
type = RuleType.valueOf(tokenizer.nextElement().toString());
} catch (Exception e) {
throw new IllegalArgumentException("Invalid format: Invalid type");
}
} else throw new IllegalArgumentException("Invalid format: entryType not found");
return getRuleEntry(packageName, name, type, tokenizer);
}
@NonNull
private static RuleEntry getRuleEntry(@NonNull String packageName, @NonNull String name,
@NonNull RuleType type, @NonNull StringTokenizer tokenizer)
throws IllegalArgumentException {
switch (type) {
case ACTIVITY:
case PROVIDER:
case RECEIVER:
case SERVICE:
return new ComponentRule(packageName, name, type, tokenizer);
case APP_OP:
return new AppOpRule(packageName, name, tokenizer);
case PERMISSION:
return new PermissionRule(packageName, name, tokenizer);
case MAGISK_HIDE:View on GitHub (pinned to 0152f468fc)
Solutions
- Inspect the rule line and add the missing entry type field (e.g. append "\tCOMPONENT").
- Filter or skip lines with fewer than the required token count before calling unflattenFromString.
- Regenerate the rules file from a complete export instead of repairing individual lines.
Example fix
// before
RuleEntry e = RuleEntry.unflattenFromString(pkg, line, true);
// after
if (line.trim().split("\t").length < 3) {
Log.w(TAG, "Skipping incomplete rule line: " + line);
} else {
RuleEntry e = RuleEntry.unflattenFromString(pkg, line, true);
} Defensive patterns
Strategy: validation
Validate before calling
boolean hasEnoughTokens(String line, boolean external) {
int min = external ? 4 : 3;
return line != null && line.split("\t", -1).length >= min;
} Try / catch
try {
RuleEntry e = RuleEntry.unflattenFromString(pkg, line, true);
} catch (IllegalArgumentException e) {
skipAndLog(line, e);
} Prevention
- Skip lines with fewer than the required token count before parsing.
- Validate exported rules files line-by-line after export.
- Avoid copy/paste round-trips that can drop trailing fields.
When it happens
Trigger: Calling RuleEntry.unflattenFromString with a ruleLine containing only one token (or only package+name for external rules), e.g. "com.example.app\tMainActivity" with no third tab-separated field.
Common situations: Truncated rule lines from partial file writes or copy/paste; blank-ish lines; a rules file saved with lines missing the type column after spreadsheet editing.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Invalid format: ssaid not found
- Invalid format: uriGrant not found
- Invalid format: mode not found
- Invalid format: enabled not found
- Invalid format: componentStatus not found
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/57ddfeba92b9c182.
Report an issue: GitHub.