pentaho/pentaho-kettle · error · KettleVersionException

Error: Invalid date being set as build date

Error message

Error:  Invalid date being set as build date

What it means

BuildVersion.setBuildDate validates the candidate build-date string by parsing it via getBuildDateAsLocalDate(); if parsing yields null the new value is rejected, the previous value restored, and KettleVersionException 'Error: Invalid date being set as build date' is thrown. This protects the version metadata from unparseable date strings.

Solutions

  1. Pass a date string in the exact format getBuildDateAsLocalDate expects (as produced by the standard build process).
  2. Inspect the value being set — log it before calling setBuildDate — and fix the build configuration/manifest that produced it.
  3. Pre-validate with a SimpleDateFormat/DateTimeFormatter parse using the same pattern before calling the setter.
  4. If the date is unknown, leave the field at its default rather than setting an invalid string.

Example fix

// before
buildVersion.setBuildDate( rawDate ); // may throw
// after
if ( BuildVersion.parseSafely( rawDate ) != null ) {
  buildVersion.setBuildDate( rawDate );
}
Defensive patterns

Strategy: validation

Validate before calling

SimpleDateFormat fmt = new SimpleDateFormat( BuildVersion.DATE_PATTERN );
fmt.setLenient( false );
try { fmt.parse( candidate ); } catch ( ParseException e ) { candidate = null; /* don't call setter */ }

Type guard

boolean isValidBuildDate( String s ) {
  if ( s == null ) return false;
  try { new SimpleDateFormat( BuildVersion.DATE_PATTERN ).parse( s ); return true; } catch ( ParseException e ) { return false; }
}

Try / catch

try {
  buildVersion.setBuildDate( value );
} catch ( KettleVersionException e ) {
  log.error( "Rejected build date: " + value );
}

Prevention

When it happens

Trigger: Calling setBuildDate(String) with a string not matching the expected date format that getBuildDateAsLocalDate can parse (null, empty, or wrong-pattern dates).

Common situations: Custom build scripts injecting a bad build date property; localization/manifest changes altering the date format; manually edited build version resources.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/25ff61a3e19d741d. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/version/BuildVersion.java:148

    }

    return null;

  }

  /**
   * @param buildDate
   *          the buildDate to set
   */
  public void setBuildDate( String buildDate ) throws KettleVersionException {
    // don't let them set a bogus date...
    String tempDate = this.buildDate;
    this.buildDate = buildDate;
    Date testDate = getBuildDateAsLocalDate();
    if ( testDate == null ) {
      // reset it to the old date...
      this.buildDate = tempDate;
      throw new KettleVersionException( "Error:  Invalid date being set as build date" ); // this should be
                                                                                          // localizable... next
      // pass....
    }
  }

  /**
   * @return the version
   */
  public String getVersion() {
    return version;
  }

  /**
   * @param revision
   *          the version to set
   */
  public void setVersion( String version ) {
    this.version = version;

View on GitHub (pinned to f3058517a1)