google/tsunami-security-scanner · error · IllegalArgumentException

Infinity range is not supported, got

Error message

Infinity range is not supported, got '%s'

What it means

VersionRange.parse rejects unbounded (open-ended) ranges: the inner string being exactly "," means both minimum and maximum were omitted (e.g. "(,)", "[,]"). The library requires at least one concrete bound, so it throws this IllegalArgumentException.

Solutions

  1. Provide at least one explicit bound, e.g. "[1.0,)" for '1.0 or later' if allowed by grammar, or concrete min/max.
  2. Represent 'all versions' with a VersionSet built from the discrete versions you care about.
  3. Pre-check with VersionRange.isValidVersionRange before parsing user-supplied ranges.

Example fix

// before
VersionRange.parse("[,)"); // any version
// after
VersionRange.parse("[1.0,2.0]");
Defensive patterns

Strategy: validation

Validate before calling

String inner = rangeString.substring(1, rangeString.length()-1).trim(); if (!inner.equals(",")) { VersionRange.parse(rangeString); }

Type guard

boolean isBoundedRange(String s) { String i = s.substring(1, s.length()-1).trim(); return !i.equals(","); }

Try / catch

try { VersionRange.parse(rangeString); } catch (IllegalArgumentException e) { log.error("Unbounded ranges unsupported: {}", rangeString); }

Prevention

When it happens

Trigger: Calling VersionRange.parse with "[,]", "(,)", "[,)", or "(,]" — any range where the inner string trims to just a comma.

Common situations: Users familiar with Maven or npm semver semantics try to express 'any version' with an open range; Tsunami fingerprints must instead enumerate versions with VersionSet or give explicit bounds.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of google/tsunami-security-scanner@363ba87b35 (2026-09-13). Data as JSON: /api/errors/619f43c2915ccf8c. Report an issue: GitHub.

Appendix: source

Thrown at common/src/main/java/com/google/tsunami/common/version/VersionRange.java:158

    String trimmedRange = rangeString.substring(1, rangeString.length() - 1).trim();

    // No more parenthesis and brackets in the string.
    if (CharMatcher.anyOf("[()]").matchesAnyOf(trimmedRange)) {
      throw new IllegalArgumentException(
          String.format(
              "Parenthesis and/or brackets not allowed within version range, got '%s'",
              rangeString));
    }

    // Only one comma that separates the minimum and maximum.
    if (CharMatcher.is(',').countIn(trimmedRange) != 1) {
      throw new IllegalArgumentException(
          String.format("Invalid range of versions, got '%s'", rangeString));
    }

    // Version range of minimum to maximum is not supported.
    if (trimmedRange.equals(",")) {
      throw new IllegalArgumentException(
          String.format("Infinity range is not supported, got '%s'", rangeString));
    }
  }
}

View on GitHub (pinned to 363ba87b35)