MuntashirAkon/AppManager · error · UnsupportedOperationException
Invalid key
Error message
Invalid key ${key} What it means
FreezeOption.test() switches over the option's configured key (all/frozen/unfrozen/with_flags/without_flags); any other key hits the default branch and throws UnsupportedOperationException. In normal use setKeyValue() already rejects unknown keys, so this indicates the internal key state was set outside the validated path or the switch lags the key map.
Solutions
- Add a case for the new key in FreezeOption.test()'s switch.
- Ensure the key is only set via setKeyValue() so it is validated against mKeysWithType.
- Keep mKeysWithType and the test()/toLocalizedString() switches in sync.
Example fix
// before
case "without_flags":
return result.setMatched((freezeFlags & intValue) != intValue);
default:
throw new UnsupportedOperationException("Invalid key " + key);
// after
case "without_flags":
return result.setMatched((freezeFlags & intValue) != intValue);
case "new_key":
return result.setMatched(/* logic */);
default:
throw new UnsupportedOperationException("Invalid key " + key); Defensive patterns
Strategy: validation
Validate before calling
if (!option.getKeysWithType().containsKey(option.getKey())) {
throw new IllegalStateException("Unrecognized key: " + option.getKey());
} Try / catch
try {
result = option.test(info, result);
} catch (UnsupportedOperationException e) {
Log.w(TAG, "Filter option key not supported", e);
result.setMatched(false);
} Prevention
- Only assign keys via setKeyValue(); never write the protected key field directly.
- Add a test() case for every entry in the option's key map.
- Unit-test toLocalizedString() and test() over all keys of each option.
When it happens
Trigger: A key added to FreezeOption's mKeysWithType map but not handled in test()'s switch; the protected `key` field mutated directly bypassing setKeyValue(); constructing an option via reflection/serialization with a stale key.
Common situations: Developer adds a new freeze filter key but forgets the test() case; a fork or modified build with extra keys; deserialization of a hand-crafted Parcel.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Invalid key
- Invalid key
- Invalid key
- Flags must be returned by the corresponding subclasses. key
- Android System (android) cannot be backed up.
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/31539d68c3dbcec8.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/filters/options/FreezeOption.java:72
}
@NonNull
@Override
public TestResult test(@NonNull IFilterableAppInfo info, @NonNull TestResult result) {
int freezeFlags = info.getFreezeFlags();
switch (key) {
case KEY_ALL:
return result.setMatched(true);
case "frozen":
return result.setMatched(freezeFlags != 0);
case "unfrozen":
return result.setMatched(freezeFlags == 0);
case "with_flags":
return result.setMatched((freezeFlags & intValue) == intValue);
case "without_flags":
return result.setMatched((freezeFlags & intValue) != intValue);
default:
throw new UnsupportedOperationException("Invalid key " + key);
}
}
@NonNull
@Override
public CharSequence toLocalizedString(@NonNull Context context) {
switch (key) {
case KEY_ALL:
return "Frozen" + getSeparatorString() + " any";
case "frozen":
return "Frozen apps only";
case "unfrozen":
return "Unfrozen apps only";
case "with_flags":
return "Frozen apps with types " + flagsToString("with_flags", intValue);
case "without_flags":
return "Frozen apps without types " + flagsToString("without_flags", intValue);
default:View on GitHub (pinned to 0152f468fc)