skylot/jadx · error · IllegalArgumentException

Unknown value '${val}' for option '${key}', expect: 'yes' or

Error message

Unknown value '${val}' for option '${key}', expect: 'yes' or 'no'

What it means

Thrown by the deprecated BaseOptionsParser.getBooleanOption when a plugin option value is not one of the accepted boolean strings ('yes', 'true', 'no', 'false', case-insensitive). Jadx plugins use this legacy API to read boolean options from the options map; any other string (including '1', '0', 'on', 'off', or typos) is rejected at parse time. The value of the offending option key and its invalid value are included in the message to aid diagnosis.

Source

Thrown at jadx-core/src/main/java/jadx/api/plugins/options/impl/BaseOptionsParser.java:37

		this.options = options;
		parseOptions();
	}

	public abstract void parseOptions();

	public boolean getBooleanOption(String key, boolean defValue) {
		String val = options.get(key);
		if (val == null) {
			return defValue;
		}
		String valLower = val.toLowerCase(Locale.ROOT);
		if (valLower.equals("yes") || valLower.equals("true")) {
			return true;
		}
		if (valLower.equals("no") || valLower.equals("false")) {
			return false;
		}
		throw new IllegalArgumentException("Unknown value '" + val + "' for option '" + key + "'"
				+ ", expect: 'yes' or 'no'");
	}

	public <T> T getOption(String key, Function<String, T> parse, T defValue) {
		String val = options.get(key);
		if (val == null) {
			return defValue;
		}
		return parse.apply(val);
	}
}

View on GitHub (pinned to e738a26571)

Solutions

  1. Change the option value to 'yes' or 'no' (jadx's preferred boolean vocabulary) or 'true'/'false'.
  2. If building the options map programmatically, normalize booleans with (b ? "yes" : "no") before insertion.
  3. Trim whitespace from values read from properties/ENV before placing them in the map, since BaseOptionsParser.getBooleanOption does not trim.
  4. Migrate the plugin to BasePluginOptionsBuilder, whose parseBoolOption does trim whitespace before checking.

Example fix

// before
Map<String,String> opts = new HashMap<>();
opts.put("debug", "on");
boolean debug = parser.getBooleanOption("debug", false);

// after
Map<String,String> opts = new HashMap<>();
opts.put("debug", "yes");
boolean debug = parser.getBooleanOption("debug", false);
Defensive patterns

Strategy: validation

Validate before calling

// Validate the boolean option value before calling getBooleanOption
String val = options.get(key);
if (val != null) {
    String lower = val.trim().toLowerCase(Locale.ROOT);
    if (!lower.equals("yes") && !lower.equals("true") && !lower.equals("no") && !lower.equals("false")) {
        throw new IllegalArgumentException(
            "Invalid boolean value for '" + key + "': " + val + ". Use yes/no/true/false.");
    }
}
boolean result = parser.getBooleanOption(key, defValue);

Type guard

static boolean isValidJadxBoolean(String val) {
    if (val == null) return true; // null defers to default
    String lower = val.toLowerCase(Locale.ROOT);
    return lower.equals("yes") || lower.equals("true")
        || lower.equals("no") || lower.equals("false");
}

Try / catch

try {
    boolean result = parser.getBooleanOption(key, defValue);
} catch (IllegalArgumentException e) {
    LOG.error("Invalid boolean option '{}', using default {}", key, defValue);
    return defValue;
}

Prevention

When it happens

Trigger: A plugin extending BaseOptionsParser calls getBooleanOption(key, defValue) and the options map contains a value outside the set {yes, true, no, false} (case-insensitive). This typically happens when a user passes --plugin-option <name>=enable or =1 from the CLI, or when a config file supplies 'on'/'off'. The check occurs only when options.get(key) returns non-null; a null (missing) key returns defValue without error.

Common situations: CLI users accustomed to 1/0 or on/off boolean syntax pass those to jadx plugin options. Integration code builds the options map programmatically using Integer.toString(booleanToInt(x)) or 0/1. A typo like 'ture' instead of 'true', or trailing whitespace from a properties file not trimmed by this parser (note: getBooleanOption does NOT trim, unlike parseBoolOption in the newer builder).

Related errors


AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14). Data as JSON: /api/errors/f80e4f80df9dbcc5. Report an issue: GitHub.