pentaho/pentaho-kettle · error · KettleException

JobEntrySimpleEval.Error.UnparsableDate

JobEntrySimpleEval.Error.UnparsableDate

Error message

JobEntrySimpleEval.Error.UnparsableDate

What it means

convertToDate in JobEntrySimpleEval throws KettleException with UnparsableDate when SimpleDateFormat.parse fails on the value being compared as a date. The job entry evaluates a field/variable with datatype 'date', and the string cannot be parsed using the selected date format mask.

Solutions

  1. Make the format mask exactly match the incoming value string (e.g. yyyy/MM/dd HH:mm:ss).
  2. Validate/log the variable value in a prior transform or via a 'Get variables' step to confirm format.
  3. Guard the value before the job entry: ensure the variable is set and non-empty.
  4. If the source format is uncontrolled, normalize it first (e.g. via a transformation that reformats the date).

Example fix

// before: mask mismatch throws UnparsableDate
df.applyPattern("yyyy-MM-dd");
df.parse("12/31/2024");
// after: align mask with value
df.applyPattern("MM/dd/yyyy");
df.parse("12/31/2024");
Defensive patterns

Strategy: validation

Validate before calling

SimpleDateFormat probe = new SimpleDateFormat(mask);
probe.setLenient(false);
try { probe.parse(valueString); } catch (ParseException e) {
  throw new KettleException("Value '" + valueString + "' does not match mask " + mask);
}

Try / catch

try {
  Date d = convertToDate(valueString, mask, df);
} catch (KettleException e) {
  logError("Unparsable date value: " + valueString + " with mask " + mask);
  result.setStopped(false); // or set failure handling
}

Prevention

When it happens

Trigger: Using a 'Simple evaluation' job entry with datatype=date whose value string (field/variable) does not match the configured date format mask; empty or null variable value; wrong mask selected (e.g. dd/MM/yyyy vs MM/dd/yyyy).

Common situations: Variable set by an earlier step contains a different format than expected; locale-dependent parsing; value is actually a timestamp string but mask has no time pattern; value missing entirely because the variable was never set.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/job/entries/simpleeval/JobEntrySimpleEval.java:996

    if ( ( !variable.contains( StringUtil.UNIX_OPEN ) && !variable.contains( StringUtil.WINDOWS_OPEN ) && !variable
      .contains( StringUtil.HEX_OPEN ) )
      && ( ( !variable.contains( StringUtil.UNIX_CLOSE ) && !variable.contains( StringUtil.WINDOWS_CLOSE ) && !variable
        .contains( StringUtil.HEX_CLOSE ) ) ) ) {
      // Add specifications to variable
      variable = StringUtil.UNIX_OPEN + variable + StringUtil.UNIX_CLOSE;
      if ( isDetailed() ) {
        logDetailed( BaseMessages.getString( PKG, "JobEntrySimpleEval.CheckingVariable", variable ) );
      }
    }
    return variable;
  }

  private Date convertToDate( String valueString, String mask, SimpleDateFormat df ) throws KettleException {
    Date datevalue = null;
    try {
      datevalue = df.parse( valueString );
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "JobEntrySimpleEval.Error.UnparsableDate", valueString ) );
    }
    return datevalue;
  }

  public static String getValueTypeDesc( int i ) {
    if ( i < 0 || i >= valueTypeDesc.length ) {
      return valueTypeDesc[0];
    }
    return valueTypeDesc[i];
  }

  public static String getFieldTypeDesc( int i ) {
    if ( i < 0 || i >= fieldTypeDesc.length ) {
      return fieldTypeDesc[0];
    }
    return fieldTypeDesc[i];
  }

View on GitHub (pinned to f3058517a1)