quarkusio/quarkus · error · IllegalArgumentException

Value '${value}' does not follow module/package=target-modul

Error message

Value '${value}' does not follow module/package=target-module(,target-module) format

What it means

When formatting --add-opens / --add-reads style module options to CLI form, MutableStandardJvmOption.toCliModulePackageList requires each stored value to be 'module/package=target-module(,target-module)'. A value without a '=' at index >= 1 (missing, or at position 0) is rejected with this IllegalArgumentException. This happens when building CLI options from multiple values instead of a single-value shortcut.

Source

Thrown at independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/MutableStandardJvmOption.java:78

            default:
                return toCliGenericArgument();
        }
    }

    private List<String> toCliModulePackageList() {
        if (!hasValue()) {
            return List.of();
        }
        var name = getName();
        var values = getValues();
        if (values.size() == 1) {
            return List.of(DASH_DASH + name + EQUALS + values.iterator().next());
        }
        final Map<String, Set<String>> modulePackages = new HashMap<>(values.size());
        for (String value : values) {
            final int slash = value.indexOf('=');
            if (slash < 1) {
                throw new IllegalArgumentException(
                        "Value '" + value + "' does not follow module/package=target-module(,target-module) format");
            }
            final Set<String> targetModules = modulePackages.computeIfAbsent(value.substring(0, slash), k -> new HashSet<>());
            final String[] packageNames = value.substring(slash + 1).split(COMMA);
            for (String packageName : packageNames) {
                targetModules.add(packageName);
            }
        }
        final String[] modulePackageList = toSortedArray(modulePackages.keySet());
        final List<String> result = new ArrayList<>(modulePackageList.length * 2);
        for (String modulePackage : modulePackageList) {
            final Set<String> targetModules = modulePackages.get(modulePackage);
            if (!targetModules.isEmpty()) {
                result.add(DASH_DASH + name);
                final StringBuilder sb = new StringBuilder()
                        .append(modulePackage).append(EQUALS);
                final String[] targetModuleNames = toSortedArray(targetModules);
                appendItems(sb, targetModuleNames, COMMA);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Correct the value to include 'module/package=target-module', e.g. 'java.base/java.lang=ALL-UNNAMED'
  2. Check each value before adding: it must contain '=' not at the first character
  3. If only one value is set, note the single-value path bypasses this check — the format is still required for multi-value options

Example fix

// before
option.addValue("java.base/java.lang");
// after
option.addValue("java.base/java.lang=ALL-UNNAMED");
Defensive patterns

Strategy: validation

Validate before calling

boolean isValidModulePackageValue(String v) {
    int i = v.indexOf('=');
    return i >= 1 && !v.substring(0, i).isBlank();
}
// check each value before addValue / toCliOptions

Type guard

boolean hasTargetModule(String v) { int i = v.indexOf('='); return i >= 1; }

Try / catch

try {
    List<String> cli = option.toCliOptions();
} catch (IllegalArgumentException e) {
    throw new IllegalArgumentException("Invalid add-opens/add-reads value: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: Calling toCliOptions() on a standard JVM option (e.g. add-opens) whose value set contains a string without the 'source=target' form, e.g. 'java.base/java.lang' (no '=') or '=java.base' (slash at index 0).

Common situations: Typing a --add-opens value in configuration as a bare module/package without '=target-module'; copying a --add-exports syntax from documentation with a typo; splitting a property on the wrong delimiter so '=' got lost.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/78b6fbb755298a44. Report an issue: GitHub.