{"record":{"id":"208f9c2f0d18dec2","repo":"pentaho/pentaho-kettle","slug":"jobentrysimpleeval-error-unparsabledate","errorCode":"JobEntrySimpleEval.Error.UnparsableDate","errorMessage":"JobEntrySimpleEval.Error.UnparsableDate","messagePattern":"JobEntrySimpleEval\\.Error\\.UnparsableDate","errorType":"error_code","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/entries/simpleeval/JobEntrySimpleEval.java","lineNumber":996,"sourceCode":"    if ( ( !variable.contains( StringUtil.UNIX_OPEN ) && !variable.contains( StringUtil.WINDOWS_OPEN ) && !variable\n      .contains( StringUtil.HEX_OPEN ) )\n      && ( ( !variable.contains( StringUtil.UNIX_CLOSE ) && !variable.contains( StringUtil.WINDOWS_CLOSE ) && !variable\n        .contains( StringUtil.HEX_CLOSE ) ) ) ) {\n      // Add specifications to variable\n      variable = StringUtil.UNIX_OPEN + variable + StringUtil.UNIX_CLOSE;\n      if ( isDetailed() ) {\n        logDetailed( BaseMessages.getString( PKG, \"JobEntrySimpleEval.CheckingVariable\", variable ) );\n      }\n    }\n    return variable;\n  }\n\n  private Date convertToDate( String valueString, String mask, SimpleDateFormat df ) throws KettleException {\n    Date datevalue = null;\n    try {\n      datevalue = df.parse( valueString );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"JobEntrySimpleEval.Error.UnparsableDate\", valueString ) );\n    }\n    return datevalue;\n  }\n\n  public static String getValueTypeDesc( int i ) {\n    if ( i < 0 || i >= valueTypeDesc.length ) {\n      return valueTypeDesc[0];\n    }\n    return valueTypeDesc[i];\n  }\n\n  public static String getFieldTypeDesc( int i ) {\n    if ( i < 0 || i >= fieldTypeDesc.length ) {\n      return fieldTypeDesc[0];\n    }\n    return fieldTypeDesc[i];\n  }","sourceCodeStart":978,"sourceCodeEnd":1014,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/entries/simpleeval/JobEntrySimpleEval.java#L978-L1014","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Make the format mask exactly match the incoming value string (e.g. yyyy/MM/dd HH:mm:ss).","Validate/log the variable value in a prior transform or via a 'Get variables' step to confirm format.","Guard the value before the job entry: ensure the variable is set and non-empty.","If the source format is uncontrolled, normalize it first (e.g. via a transformation that reformats the date)."],"exampleFix":"// before: mask mismatch throws UnparsableDate\ndf.applyPattern(\"yyyy-MM-dd\");\ndf.parse(\"12/31/2024\");\n// after: align mask with value\ndf.applyPattern(\"MM/dd/yyyy\");\ndf.parse(\"12/31/2024\");","handlingStrategy":"validation","validationCode":"SimpleDateFormat probe = new SimpleDateFormat(mask);\nprobe.setLenient(false);\ntry { probe.parse(valueString); } catch (ParseException e) {\n  throw new KettleException(\"Value '\" + valueString + \"' does not match mask \" + mask);\n}","typeGuard":null,"tryCatchPattern":"try {\n  Date d = convertToDate(valueString, mask, df);\n} catch (KettleException e) {\n  logError(\"Unparsable date value: \" + valueString + \" with mask \" + mask);\n  result.setStopped(false); // or set failure handling\n}","preventionTips":["Always make the date mask exactly match the producing format.","Log variable values upstream before date comparison.","Use non-lenient parsing in tests to catch format drift early.","Never leave date variables unset before the evaluation runs."],"tags":["kettle","date-parsing","job-entry","validation"],"backgroundTag":"invalid-date-format","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}