MuntashirAkon/AppManager · error · IllegalArgumentException

Invalid format: freeze_type not found

Error message

Invalid format: freeze_type not found

What it means

FreezeRule's constructor parses the freeze_type token from a flattened rule string. If the StringTokenizer is exhausted before the freeze type is present, it throws this IllegalArgumentException. It means the rule line is truncated or malformed relative to the expected FREEZE rule format.

Solutions

  1. Ensure the flattened rule string for a FREEZE rule contains a numeric freeze_type token after the package name
  2. Validate token count (>=2 for the tokenizer passed in) before constructing FreezeRule
  3. Re-export the rules file from a matching AppManager version to get the correct field order
  4. Wrap rule parsing in try-catch for IllegalArgumentException and skip/log the malformed line

Example fix

// before
StringTokenizer st = new StringTokenizer("com.example.app");
FreezeRule r = new FreezeRule("com.example.app", st); // throws
// after
StringTokenizer st = new StringTokenizer("com.example.app\t1");
FreezeRule r = new FreezeRule("com.example.app", st); // freeze_type=1
Defensive patterns

Strategy: try-catch

Validate before calling

String[] parts = ruleLine.split("\t");
if (parts.length < 2) throw new IllegalArgumentException("FREEZE rule needs freeze_type");
Integer.parseInt(parts[1]);

Type guard

boolean isParsableFreezeRule(String line) { String[] p = line.split("\t"); return p.length >= 2 && p[1].matches("\\d+"); }

Try / catch

try { new FreezeRule(pkg, tokenizer); } catch (IllegalArgumentException e) { log.warn("Skipping malformed FREEZE rule: " + ruleLine, e); }

Prevention

When it happens

Trigger: Calling new FreezeRule(packageName, tokenizer) with a tokenizer that has no remaining tokens after the constructor's super() consumes the package name, e.g. parsing a flattened string with only one field.

Common situations: Hand-edited or truncated rules.txt / external rules import files, older export formats missing the freeze_type field, or splitting a flattened string with the wrong delimiter so tokens are lost.

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/7cd8bc2e79f71f2e. Report an issue: GitHub.

Appendix: source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/rules/struct/FreezeRule.java:26

import java.util.StringTokenizer;

import io.github.muntashirakon.AppManager.rules.RuleType;
import io.github.muntashirakon.AppManager.utils.FreezeUtils;

public class FreezeRule extends RuleEntry {
    @FreezeUtils.FreezeMethod
    private int mFreezeType;

    public FreezeRule(@NonNull String packageName, @FreezeUtils.FreezeMethod int freezeType) {
        super(packageName, STUB, RuleType.FREEZE);
        mFreezeType = freezeType;
    }

    public FreezeRule(@NonNull String packageName, @NonNull StringTokenizer tokenizer) {
        super(packageName, STUB, RuleType.FREEZE);
        if (tokenizer.hasMoreElements()) {
            mFreezeType = Integer.parseInt(tokenizer.nextElement().toString());
        } else throw new IllegalArgumentException("Invalid format: freeze_type not found");
    }

    public int getFreezeType() {
        return mFreezeType;
    }

    public void setFreezeType(@FreezeUtils.FreezeMethod int freezeType) {
        mFreezeType = freezeType;
    }

    @NonNull
    @Override
    public String toString() {
        return "FreezeRule{" +
                "mFreezeType=" + mFreezeType +
                ", packageName='" + packageName + '\'' +
                '}';
    }

View on GitHub (pinned to 0152f468fc)