MuntashirAkon/AppManager · error · IllegalArgumentException

Invalid format: componentStatus not found

Error message

Invalid format: componentStatus not found

What it means

ComponentRule parses the component status from the next StringTokenizer token and normalizes it via fixComponentStatus. If the tokenizer has no remaining element, the rule line lacks the componentStatus column and the constructor throws IllegalArgumentException('Invalid format: componentStatus not found').

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/rules/struct/ComponentRule.java:93

    @ComponentStatus
    private final String mComponentStatus;

    @Nullable
    @ComponentStatus
    private String mLastComponentStatus;

    public ComponentRule(@NonNull String packageName, @NonNull String name, RuleType componentType,
                         @NonNull @ComponentStatus String componentStatus) {
        super(packageName, name, componentType);
        mComponentStatus = fixComponentStatus(componentStatus);
    }

    public ComponentRule(@NonNull String packageName, @NonNull String name, RuleType componentType,
                         @NonNull StringTokenizer tokenizer) throws IllegalArgumentException {
        super(packageName, name, componentType);
        if (tokenizer.hasMoreElements()) {
            mComponentStatus = fixComponentStatus(tokenizer.nextElement().toString());
        } else throw new IllegalArgumentException("Invalid format: componentStatus not found");
    }

    public ComponentName getComponentName() {
        return new ComponentName(packageName, name);
    }

    @NonNull
    @ComponentStatus
    public String getComponentStatus() {
        return mComponentStatus;
    }

    public void setLastComponentStatus(@Nullable String lastComponentStatus) {
        mLastComponentStatus = lastComponentStatus;
    }

    public boolean applyDefaultState() {
        if (mLastComponentStatus == null) {

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Ensure each component rule line includes the status column (e.g. pkg<TAB>name<TAB>block)
  2. Check tokenizer.hasMoreElements() and skip malformed lines before constructing ComponentRule
  3. Regenerate the rules export with the current app version so all rows carry a status
  4. Catch IllegalArgumentException around rule parsing and log/skip bad rows

Example fix

// before
ComponentRule rule = new ComponentRule(pkg, name, RuleType.ACTIVITY, new StringTokenizer(line, "\t"));
// after
StringTokenizer st = new StringTokenizer(line, "\t");
if (!st.hasMoreElements()) {
    Log.w(TAG, "Skipping malformed component line: " + line);
    return;
}
ComponentRule rule = new ComponentRule(pkg, name, RuleType.ACTIVITY, st);
Defensive patterns

Strategy: validation

Validate before calling

StringTokenizer st = new StringTokenizer(line, "\t");
if (st.countTokens() < 3) { // package + name + status
    Log.w(TAG, "Malformed component line: " + line);
    return;
}

Try / catch

try {
    rule = new ComponentRule(pkg, name, componentType, tokenizer);
} catch (IllegalArgumentException e) {
    Log.w(TAG, "Skipping invalid component rule: " + line, e);
}

Prevention

When it happens

Trigger: new ComponentRule(pkg, name, componentType, tokenizer) where the tokenizer is exhausted — an ACTIVITY/SERVICE/RECEIVER/PROVIDER rule line containing only package and component name without a status token.

Common situations: Truncated or hand-edited rules TSV backups; importing rules exported from older App Manager versions with different column layouts; lines damaged by copy-paste or encoding issues.

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


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