pentaho/pentaho-kettle · error · ParseException
Unknown date string. Date string is null.
Error message
Unknown date string. Date string is null.
What it means
DateDetector.getDateFromStringByFormat also validates the date string itself: if dateString is null, a ParseException 'Unknown date string. Date string is null.' is thrown. The non-lenient parser would otherwise NPE or misbehave, so this gives an explicit, checkable error.
Solutions
- Null-check the input string before parsing and skip/default the field
- Treat empty strings as null and handle explicitly before conversion
- Coalesce with a default date when the field is legitimately optional
Example fix
// before
Date d = DateDetector.getDateFromStringByFormat(row.getString("dt"), fmt);
// after
String s = row.getString("dt");
Date d = (s == null || s.isEmpty()) ? null : DateDetector.getDateFromStringByFormat(s, fmt); Defensive patterns
Strategy: validation
Validate before calling
if (dateString == null || dateString.trim().isEmpty()) { return null; /* optional field */ } Type guard
static boolean isPresent(String s) { return s != null && !s.trim().isEmpty(); } Try / catch
try {
return DateDetector.getDateFromStringByFormat(s, fmt);
} catch (ParseException e) {
if (s == null) return null; // treat as missing
throw e;
} Prevention
- Null-check/trim row fields before date conversion
- Define null-handling policy per field in the transformation
- Use ISNULL checks in the pipeline before the date step
When it happens
Trigger: Calling getDateFromStringByFormat(null, format), e.g. when the upstream field was absent in a row, a CSV column was missing, or a variable did not resolve.
Common situations: Optional date columns in input files; rows with empty/missing fields reaching date conversion; unresolvable Kettle environment variables.
Related errors
- Unknown date format. Format is null.
- Could not apply local format for
- Could not apply the given format " + sArg2 + " on the…
- TO_DATE Couldn't convert String to Date
- <toString()> : couldn't convert string
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/c98001ac611d6ba9.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/util/DateDetector.java:245
return getDateFromStringByFormat( dateString, dateFormat );
}
/**
*
* @param dateString
* date string for parse
* @param dateFormat
* format which should be applied for string
* @return {@link java.util.Date} converted from dateString by format
* @throws ParseException
* if we can not parse date string
*/
public static Date getDateFromStringByFormat( String dateString, String dateFormat ) throws ParseException {
if ( dateFormat == null ) {
throw new ParseException( "Unknown date format. Format is null. ", 0 );
}
if ( dateString == null ) {
throw new ParseException( "Unknown date string. Date string is null. ", 0 );
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat( dateFormat );
simpleDateFormat.setLenient( false ); // Don't automatically convert invalid date.
return simpleDateFormat.parse( dateString );
}
/**
*
* @param dateString
* - date string for detect date format
* @return {@link java.lang.String} string which represented Date Format or null
*
*/
public static String detectDateFormat( String dateString ) {
return detectDateFormat( dateString, null );
}
/**View on GitHub (pinned to f3058517a1)