skylot/jadx · error · IllegalArgumentException

Unknown value '${val}' for option '${name}', expect: 'yes' o

Error message

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

What it means

Thrown by BasePluginOptionsBuilder.parseBoolOption when a boolean option value (after trim and lowercase) is not 'yes', 'true', 'no', or 'false'. This is the modern equivalent of error 40 used by boolOption registrations. Unlike the deprecated getBooleanOption, parseBoolOption does trim whitespace before checking, so only truly unrecognized tokens trigger it.

Source

Thrown at jadx-core/src/main/java/jadx/api/plugins/options/impl/BasePluginOptionsBuilder.java:122

				throw new RuntimeException("Parse failed for option: " + option.name + ", value: " + value, e);
			}
		}
		try {
			option.getSetter().accept(parsedValue);
		} catch (Exception e) {
			throw new RuntimeException("Setter invoke failed for option: " + option.name + ", value: " + parsedValue, e);
		}
	}

	private static boolean parseBoolOption(String name, String val) {
		String valLower = val.trim().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 '" + name + "', expect: 'yes' or 'no'");
	}

	private <T> OptionBuilder<T> addOption(OptionBuilder<T> optionData) {
		this.options.add((OptionData<?>) optionData);
		return optionData;
	}

	protected static class OptionData<T> implements OptionDescription, OptionBuilder<T> {
		private final String name;
		private String desc;
		private List<T> values = Collections.emptyList();
		private OptionType type = OptionType.STRING;
		private Set<OptionFlag> flags = EnumSet.noneOf(OptionFlag.class);
		private Function<String, T> parser;
		private Function<T, String> formatter;
		private Consumer<T> setter;
		private T defaultValue;

View on GitHub (pinned to e738a26571)

Solutions

  1. Use 'yes' or 'no' (jadx convention) or 'true'/'false' for the boolean option value.
  2. When building the options map in code, normalize with (b ? "yes" : "no").
  3. Consult the plugin's option descriptions (getOptionsDescriptions) to confirm the option is boolean-typed before supplying a value.

Example fix

// before
// CLI: --plugin-option myplugin.verbose=1

// after
// CLI: --plugin-option myplugin.verbose=yes
Defensive patterns

Strategy: validation

Validate before calling

String val = userOptionsMap.get(optionName);
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(
            "Boolean option '" + optionName + "' must be yes/no/true/false, got: " + val);
    }
}

Type guard

static boolean isValidBoolOptionValue(String val) {
    if (val == null) return true;
    String lower = val.trim().toLowerCase(Locale.ROOT);
    return lower.equals("yes") || lower.equals("true")
        || lower.equals("no") || lower.equals("false");
}

Try / catch

try {
    optionsBuilder.setOptions(userOptionsMap);
} catch (RuntimeException e) {
    Throwable cause = e.getCause();
    if (cause instanceof IllegalArgumentException
            && cause.getMessage().contains("expect: 'yes' or 'no'")) {
        LOG.error("Invalid boolean value for plugin option: {}", cause.getMessage());
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: A plugin registers a boolOption(name) and the user supplies a value outside {yes, true, no, false}. The value is trimmed and lowercased first, so ' YES ' works but '1', '0', 'on', 'off', 'enable', 'disable' do not. The parseBoolOption function is the parser for boolOption, so its IllegalArgumentException is then wrapped by parseOption (error 41).

Common situations: CLI users pass 1/0 or on/off for a boolean plugin option. A config migration from another tool that uses different boolean conventions. A typo such as 'tru' or 'flase'.

Related errors


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