OpenAPITools/openapi-generator · error · RuntimeException
Error parsing version expression '{requestedVersion}' as a v
Error message
Error parsing version expression '{requestedVersion}' as a version constraint What it means
Thrown inside JavaHelidonCommonCodegen's VersionConstraint helper when the requested Helidon version string is neither a plain unsigned integer (that path is error 129) nor parseable by the Aether/Maven version scheme as a version constraint. The generator supports exact versions ('4.1.0') and Maven ranges ('[3.0.0,4.0.0)'), and anything else — suffixes, partial semver, junk — fails here with this wrapper RuntimeException.
Source
Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaHelidonCommonCodegen.java:878
private VersionConstraint constraint(VersionScheme versionScheme, String requestedVersion) {
try {
int asSingleNumber = Integer.parseUnsignedInt(requestedVersion);
try {
return versionScheme.parseVersionConstraint(String.format(Locale.getDefault(),
"[%s,%d-alpha)",
requestedVersion,
asSingleNumber + 1));
} catch (InvalidVersionSpecificationException ex) {
throw new RuntimeException("Error preparing constraint for version expression '"
+ requestedVersion
+ "' treated as major version " + asSingleNumber,
ex);
}
} catch (NumberFormatException nfe) {
try {
return versionScheme.parseVersionConstraint(requestedVersion);
} catch (InvalidVersionSpecificationException ex) {
throw new RuntimeException("Error parsing version expression '"
+ requestedVersion
+ "' as a version constraint",
ex);
}
}
}
/**
* Retrieves the list of supported versions from the web site or, failing that, local preferences or, failing that,
* hard-coded versions.
*
* @return list of supported versions
* @throws IOException in case of error accessing the web site and reading the local file
*/
private List<String> versions() throws IOException, BackingStoreException {
HttpClient httpClient = HttpClient.newBuilder()
.connectTimeout(CONNECTION_TIMEOUT)View on GitHub (pinned to fcec517be3)
Solutions
- Use an exact released version: helidonVersion=4.1.0
- Or a well-formed Maven range: helidonVersion="[4.0.0,5.0.0)" — note brackets/parentheses and both bounds
- Remove prefixes like 'v' and any build-metadata decorations; '4.1.0-SNAPSHOT' alone is fine
- Echo the interpolated value in CI before generation to catch empty/mangled variable substitution
Example fix
# before openapi-generator-cli generate -g java-helidon-server -i api.yaml \ --additional-properties helidonVersion=4.x # after openapi-generator-cli generate -g java-helidon-server -i api.yaml \ --additional-properties helidonVersion=4.1.0
Defensive patterns
Strategy: validation
Validate before calling
String v = String.valueOf(opts.get("helidonVersion"));
boolean exact = v.matches("\d+(\.\d+)*(-[A-Za-z0-9.]+)?");
boolean range = v.startsWith("[") || v.startsWith("(");
if (!exact && !range) {
throw new IllegalArgumentException("helidonVersion '" + v + "' is neither an exact version nor a Maven range like [3.0.0,4.0.0)");
} Try / catch
try {
generator.generate();
} catch (RuntimeException e) {
if (e.getMessage() != null && e.getMessage().contains("version expression")) {
throw new IllegalArgumentException("Bad helidonVersion: " + opts.get("helidonVersion"), e);
}
throw e;
} Prevention
- Reject 'v'-prefixed and wildcard ('4.x', 'latest') version strings at config load time
- Echo interpolated CI variables into the build log before generation to spot mangled values
- Reuse the same version-format helper everywhere versions enter your pipeline
When it happens
Trigger: Passing --additional-properties helidonVersion=4.x, helidonVersion=v4.1.0, helidonVersion="4.1.0-SNAPSHOT (build 42)", helidonVersion=latest, or a truncated range like "[3.0.0," to -g java-helidon-server / -g java-helidon-client. Any input Aether's parseVersionConstraint rejects after the numeric shortcut also failed.
Common situations: Developers used to semver tooling pass '4.x' or 'v4.1.0' style selectors that Maven ranges do not understand. CI pipelines interpolating environment variables into helidonVersion can inject empty or decorated strings ('4.1.0-rc{BUILD}').
Related errors
- Error preparing constraint for version expression '{requeste
- Both %s and %s properties were set with different value.
- Helidon version %s uses the %s prefix for EE dependencies bu
- Version %s of MicroProfile Rest Client is not supported or i
- Unexpected serializationLibrary value: {serializationLibrary
AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22).
Data as JSON: /api/errors/b610ff0c098e9548.
Report an issue: GitHub.