OpenAPITools/openapi-generator · error · IllegalArgumentException

Both %s and %s properties were set with different value.

Error message

Both %s and %s properties were set with different value.

What it means

Thrown by JavaHelidonCommonCodegen when both helidonVersion and parentVersion additional properties are set to different strings. The Helidon generator derives its toolchain from helidonVersion but also honors the generic parentVersion; when both are present they must agree, otherwise the generated pom would mix incompatible Helidon BOMs and parent POMs. If only one is set, it wins; if neither, the detected default Helidon version is used.

Source

Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaHelidonCommonCodegen.java:216

        importMapping.put("Headers", helidonMajorVersion == 3 ? "io.helidon.http.common.Headers" : "io.helidon.http.Headers");
        importMapping.put("Optional", "java.util.Optional");
        importMapping.put("Collectors", "java.util.stream.Collectors");

        String userHelidonVersion = "";
        String userParentVersion = "";

        if (additionalProperties.containsKey(CodegenConstants.PARENT_VERSION)) {
            userParentVersion = additionalProperties.get(CodegenConstants.PARENT_VERSION).toString();
        }

        if (additionalProperties.containsKey(HELIDON_VERSION)) {
            userHelidonVersion = additionalProperties.get(HELIDON_VERSION).toString();
        }

        if (!userHelidonVersion.isEmpty()) {
            if (!userParentVersion.isEmpty() && !userHelidonVersion.equals(userParentVersion)) {
                throw new IllegalArgumentException(
                        String.format(Locale.ROOT,
                                "Both %s and %s properties were set with different value.",
                                CodegenConstants.PARENT_VERSION,
                                HELIDON_VERSION));
            }
            setHelidonVersion(userHelidonVersion);

        } else if (!userParentVersion.isEmpty()) {
            setHelidonVersion(userParentVersion);
        } else {
            setHelidonVersion(VersionUtil.instance().defaultVersion());
        }

        if (helidonMajorVersion > 3) {
            importMapping.put("Status", "io.helidon.http.Status");
            importMapping.put("HexFormat", "java.util.HexFormat");
        }

View on GitHub (pinned to fcec517be3)

Solutions

  1. Set both properties to the same version: helidonVersion=4.1.0,parentVersion=4.1.0
  2. Or remove one of them — helidonVersion alone is sufficient for Helidon projects
  3. If your build requires a specific parent POM version, update helidonVersion to match it, not the other way around
  4. Centralize the version in one CI variable and inject it into both keys to keep them synchronized

Example fix

# before
openapi-generator-cli generate -g java-helidon-server -i api.yaml \
  --additional-properties helidonVersion=3.2.0,parentVersion=4.0.0

# after
openapi-generator-cli generate -g java-helidon-server -i api.yaml \
  --additional-properties helidonVersion=4.0.0,parentVersion=4.0.0
Defensive patterns

Strategy: validation

Validate before calling

String helidon = (String) opts.get("helidonVersion");
String parent = (String) opts.get("parentVersion");
if (helidon != null && parent != null && !helidon.equals(parent)) {
    throw new IllegalArgumentException("helidonVersion=" + helidon + " and parentVersion=" + parent + " must match; set only one");
}

Try / catch

try {
    config.processOpts();
} catch (IllegalArgumentException e) {
    // version-pair mismatch: safe to fail and prompt the caller — nothing was generated
    throw new ConfigConflictException("Helidon version options conflict: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: Passing --additional-properties helidonVersion=3.2.0,parentVersion=4.0.0 (any mismatched pair) to -g java-helidon-server or -g java-helidon-client. Commonly happens when a CI template sets parentVersion for the Maven parent while a developer adds helidonVersion to pin a different release, or when upgrading one property in a shared config but not the other.

Common situations: Platform teams standardize parentVersion across many generators, while the Helidon-specific module pins helidonVersion; after a Helidon upgrade (3.x to 4.x) only one of the two is bumped. Also appears when generating Helidon SE vs MP flavors with a copied config where the versions drifted.

Related errors


AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22). Data as JSON: /api/errors/47df3608ea3a52b9. Report an issue: GitHub.