{"record":{"id":"b610ff0c098e9548","repo":"OpenAPITools/openapi-generator","slug":"error-parsing-version-expression-requestedversio","errorCode":null,"errorMessage":"Error parsing version expression '{requestedVersion}' as a version constraint","messagePattern":"Error parsing version expression '(.+?)' as a version constraint","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaHelidonCommonCodegen.java","lineNumber":878,"sourceCode":"        private VersionConstraint constraint(VersionScheme versionScheme, String requestedVersion) {\n            try {\n                int asSingleNumber = Integer.parseUnsignedInt(requestedVersion);\n                try {\n                    return versionScheme.parseVersionConstraint(String.format(Locale.getDefault(),\n                            \"[%s,%d-alpha)\",\n                            requestedVersion,\n                            asSingleNumber + 1));\n                } catch (InvalidVersionSpecificationException ex) {\n                    throw new RuntimeException(\"Error preparing constraint for version expression '\"\n                            + requestedVersion\n                            + \"' treated as major version \" + asSingleNumber,\n                            ex);\n                }\n            } catch (NumberFormatException nfe) {\n                try {\n                    return versionScheme.parseVersionConstraint(requestedVersion);\n                } catch (InvalidVersionSpecificationException ex) {\n                    throw new RuntimeException(\"Error parsing version expression '\"\n                            + requestedVersion\n                            + \"' as a version constraint\",\n                            ex);\n                }\n            }\n        }\n\n        /**\n         * Retrieves the list of supported versions from the web site or, failing that, local preferences or, failing that,\n         * hard-coded versions.\n         *\n         * @return list of supported versions\n         * @throws IOException in case of error accessing the web site and reading the local file\n         */\n        private List<String> versions() throws IOException, BackingStoreException {\n\n            HttpClient httpClient = HttpClient.newBuilder()\n                    .connectTimeout(CONNECTION_TIMEOUT)","sourceCodeStart":860,"sourceCodeEnd":896,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaHelidonCommonCodegen.java#L860-L896","documentation":"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.","triggerScenarios":"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.","commonSituations":"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}').","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"],"exampleFix":"# before\nopenapi-generator-cli generate -g java-helidon-server -i api.yaml \\\n  --additional-properties helidonVersion=4.x\n\n# after\nopenapi-generator-cli generate -g java-helidon-server -i api.yaml \\\n  --additional-properties helidonVersion=4.1.0","handlingStrategy":"validation","validationCode":"String v = String.valueOf(opts.get(\"helidonVersion\"));\nboolean exact = v.matches(\"\\d+(\\.\\d+)*(-[A-Za-z0-9.]+)?\");\nboolean range = v.startsWith(\"[\") || v.startsWith(\"(\");\nif (!exact && !range) {\n    throw new IllegalArgumentException(\"helidonVersion '\" + v + \"' is neither an exact version nor a Maven range like [3.0.0,4.0.0)\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    generator.generate();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"version expression\")) {\n        throw new IllegalArgumentException(\"Bad helidonVersion: \" + opts.get(\"helidonVersion\"), e);\n    }\n    throw e;\n}","preventionTips":["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"],"tags":["java","helidon","openapi-generator","version-management","maven","version-range"],"backgroundTag":"version-constraint-parse-error","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}