{"record":{"id":"996cad29c49e7e66","repo":"GoogleContainerTools/jib","slug":"unable-to-parse-versionstring","errorCode":null,"errorMessage":"unable to parse '${versionString}'","messagePattern":"unable to parse '(.+?)'","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/VersionChecker.java","lineNumber":144,"sourceCode":"    }\n    return true;\n  }\n\n  /**\n   * Parses and returns a version object.\n   *\n   * @return the parsed version\n   * @throws IllegalArgumentException if an exception occurred\n   */\n  private V parseVersion(String versionString) {\n    // catch other exceptions and turn into an IllegalArgumentException\n    try {\n      return converter.apply(versionString);\n    } catch (IllegalArgumentException ex) {\n      throw ex; // rethrow\n    } catch (Throwable ex) {\n      // Gradle's GradleVersion throws all sorts of unchecked exceptions\n      throw new IllegalArgumentException(\"unable to parse '\" + versionString + \"'\", ex);\n    }\n  }\n}\n","sourceCodeStart":126,"sourceCodeEnd":148,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/VersionChecker.java#L126-L148","documentation":"VersionChecker.parseVersion converts a version string via a caller-supplied converter. Jib catches any Throwable (not just IllegalArgumentException) because converters like Gradle's GradleVersion throw assorted unchecked exceptions, and wraps them into IllegalArgumentException 'unable to parse <versionString>'. IllegalArgumentExceptions from the converter itself are rethrown unchanged.","triggerScenarios":"parseVersion called from pluginVersion or compatibleVersion when the converter (e.g. GradleVersion.version, Maven artifact version parsing) throws a non-IllegalArgumentException Throwable for the given version string.","commonSituations":"A plugin/build-script version string like '1.0-SNAPSHOT-custom' or an empty/garbage value that GradleVersion or Maven's ComparableVersion cannot handle; reading project.version that contains non-numeric or oddly formatted text.","solutions":["Fix the version string to a format the converter understands (e.g. SemVer-like '1.2.3' for GradleVersion).","Log or inspect the versionString in the message to see exactly what was passed and where it comes from (project.version, plugin version, dependency metadata).","If versions come from external metadata, sanitize/normalize them (strip suffixes like '-SNAPSHOT') before comparison."],"exampleFix":"// before\nversion = '1.0.${buildNumber}' // interpolates to 1.0.${buildNumber} if unset\n// after\nversion = '1.0.' + (findProperty('buildNumber') ?: '0')","handlingStrategy":"try-catch","validationCode":"// Validate version format before passing to Jib's VersionChecker\nif (versionString == null || !versionString.matches(\"\\\\d+(\\\\.\\\\d+)*([-.].*)?\")) {\n  throw new IllegalArgumentException(\"non-parseable version: \" + versionString);\n}","typeGuard":null,"tryCatchPattern":"try {\n  checker.compatibleVersion(minimumVersion);\n} catch (IllegalArgumentException e) {\n  logger.error(\"Could not parse version, check project/plugin version format: \" + e.getMessage());\n}","preventionTips":["Keep project.version in standard SemVer/compatible formats","Avoid unresolved placeholders or non-numeric junk in version strings","Log the raw version string when doing minimum-version checks"],"tags":["version-parsing","java","build-tool"],"backgroundTag":"invalid-argument-format","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}