pentaho/pentaho-kettle · error · ParseException
Unknown date format.
Error message
Unknown date format.
What it means
DateDetector.getDateFromString(String) first detects the format of the input string via detectDateFormat. When no known pattern matches, it returns null and this ParseException 'Unknown date format.' is thrown at error offset 0.
Solutions
- Normalize the input string to a supported format (e.g. ISO yyyy-MM-dd) before calling getDateFromString
- Check DateDetector supported patterns and add yours if extendable
- Use getDateFromStringByFormat with an explicit format you know the data follows
- Validate input first with isValidDate and handle invalid rows explicitly
Example fix
// before
Date d = DateDetector.getDateFromString(userInput);
// after
if (!DateDetector.isValidDate(userInput)) { throw new IllegalArgumentException("Unsupported date: " + userInput); }
Date d = DateDetector.getDateFromStringByFormat(userInput, "yyyy-MM-dd"); Defensive patterns
Strategy: validation
Validate before calling
if (dateString == null || dateString.trim().isEmpty()) throw new IllegalArgumentException("Date string empty");
if (!DateDetector.isValidDate(dateString)) throw new IllegalArgumentException("Unsupported date format: " + dateString); Try / catch
try {
return DateDetector.getDateFromString(s);
} catch (ParseException e) {
LOG.warn("Unparseable date '{}', using fallback", s);
return null;
} Prevention
- Normalize external date inputs to ISO-8601 before parsing
- Pre-validate with DateDetector.isValidDate
- Log unmatched formats to extend pattern coverage
When it happens
Trigger: Passing a date string whose layout does not match any pattern in detectDateFormat (e.g. '2026/13/45', locale-formatted months, unexpected separators); empty or null date strings that detection cannot resolve.
Common situations: Parsing user-entered dates in Kettle Excel/CSV input; strings from external systems with unfamiliar date formats; non-Latin month names without locale support.
Related errors
- 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
- Unknown date format. Format is null.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/7de3b284ef2a8a4d.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/util/DateDetector.java:209
public static String getDateFormatByRegex( String regex, String locale ) {
if ( locale != null && LOCALE_en_US.equalsIgnoreCase( locale ) ) {
return (String) DATE_FORMAT_TO_REGEXPS_US.getKey( regex );
}
return (String) DATE_FORMAT_TO_REGEXPS.getKey( regex );
}
/**
*
* @param dateString
* date string for parse
* @return {@link java.util.Date} converted from dateString by detected format
* @throws ParseException
* - if we can not detect date format for string or we can not parse date string
*/
public static Date getDateFromString( String dateString ) throws ParseException {
String dateFormat = detectDateFormat( dateString );
if ( dateFormat == null ) {
throw new ParseException( "Unknown date format.", 0 );
}
return getDateFromStringByFormat( dateString, dateFormat );
}
/**
*
* @param dateString
* date string for parse
* @return {@link java.util.Date} converted from dateString by detected format
* @throws ParseException
* - if we can not detect date format for string or we can not parse date string
*/
public static Date getDateFromString( String dateString, String locale ) throws ParseException {
String dateFormat = detectDateFormat( dateString, locale );
if ( dateFormat == null ) {
throw new ParseException( "Unknown date format.", 0 );
}
return getDateFromStringByFormat( dateString, dateFormat );View on GitHub (pinned to f3058517a1)