GoogleContainerTools/jib · error · IllegalArgumentException

unable to parse '${versionString}'

Error message

unable to parse '${versionString}'

What it means

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.

Source

Thrown at jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/VersionChecker.java:144

    }
    return true;
  }

  /**
   * Parses and returns a version object.
   *
   * @return the parsed version
   * @throws IllegalArgumentException if an exception occurred
   */
  private V parseVersion(String versionString) {
    // catch other exceptions and turn into an IllegalArgumentException
    try {
      return converter.apply(versionString);
    } catch (IllegalArgumentException ex) {
      throw ex; // rethrow
    } catch (Throwable ex) {
      // Gradle's GradleVersion throws all sorts of unchecked exceptions
      throw new IllegalArgumentException("unable to parse '" + versionString + "'", ex);
    }
  }
}

View on GitHub (pinned to fb949e2676)

Solutions

  1. Fix the version string to a format the converter understands (e.g. SemVer-like '1.2.3' for GradleVersion).
  2. 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).
  3. If versions come from external metadata, sanitize/normalize them (strip suffixes like '-SNAPSHOT') before comparison.

Example fix

// before
version = '1.0.${buildNumber}' // interpolates to 1.0.${buildNumber} if unset
// after
version = '1.0.' + (findProperty('buildNumber') ?: '0')
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate version format before passing to Jib's VersionChecker
if (versionString == null || !versionString.matches("\\d+(\\.\\d+)*([-.].*)?")) {
  throw new IllegalArgumentException("non-parseable version: " + versionString);
}

Try / catch

try {
  checker.compatibleVersion(minimumVersion);
} catch (IllegalArgumentException e) {
  logger.error("Could not parse version, check project/plugin version format: " + e.getMessage());
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06). Data as JSON: /api/errors/996cad29c49e7e66. Report an issue: GitHub.