pentaho/pentaho-kettle · error · ParseException

The default value " + defaultValue + " should be of format…

Error message

The default value " + defaultValue + " should be of format : " + ValueMetaBase.DEFAULT_TIMESTAMP_PARSE_MASK

What it means

ParseException re-thrown by PentahoAvroOutputFormat.getTimeStampTypeForDefaultValue when the default value string cannot be parsed using ValueMetaBase.DEFAULT_TIMESTAMP_PARSE_MASK. The method converts a timestamp string to epoch milliseconds for TIMESTAMP_MILLIS-typed Avro fields.

Solutions

  1. Set the default value to match ValueMetaBase.DEFAULT_TIMESTAMP_PARSE_MASK exactly (e.g. '2024/12/31 10:15:00')
  2. Pre-parse the timestamp with a flexible parser and reformat into the expected mask before configuring the field
  3. Strip timezone suffixes or convert to the expected textual format
  4. Leave the default empty/null if the field has no required default
  5. Use the reported error offset to locate the offending character in the value

Example fix

// before
field.setDefault( "2024-12-31T10:15:00Z" );
// after
field.setDefault( "2024/12/31 10:15:00" ); // matches DEFAULT_TIMESTAMP_PARSE_MASK
Defensive patterns

Strategy: validation

Validate before calling

String MASK = org.pentaho.di.compatibility.ValueMetaBase.DEFAULT_TIMESTAMP_PARSE_MASK;
new java.text.SimpleDateFormat( MASK ).parse( defaultValue ); // throws ParseException if not in mask

Type guard

boolean isValidTimestampDefault( String v ) { try { new java.text.SimpleDateFormat( "yyyy/MM/dd HH:mm:ss" ).parse( v ); return true; } catch ( ParseException e ) { return false; } }

Try / catch

try { long epochMillis = getTimeStampTypeForDefaultValue( defaultValue ); }
catch ( ParseException pe ) { throw new IllegalArgumentException( "Use format yyyy/MM/dd HH:mm:ss for timestamp defaults: " + defaultValue ); }

Prevention

When it happens

Trigger: mapDefaultValuesToDataTypes dispatches a TIMESTAMP_MILLIS field to getTimeStampTypeForDefaultValue and the SimpleDateFormat with DEFAULT_TIMESTAMP_PARSE_MASK fails on the string — wrong format, empty value, or invalid date/time components.

Common situations: Entering only a date ('2024/12/31') without the time portion; using ISO-8601 with 'T' separators ('2024-12-31T10:15:00') when the mask expects space separators; timezone suffixes like 'Z' not accepted by the mask; defaults migrated from other tooling with different conventions.

Related errors


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

Appendix: source

Thrown at plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/output/PentahoAvroOutputFormat.java:345

   * <P>
   *  ValueMetaBase.DEFAULT_TIMESTAMP_PARSE_MASK is the default timestamp parser used for
   *  Avro To PDI and vice-versa conversions.
   * @see PentahoAvroRecordWriter#createAvroRecord
   * </P>
   *
   * <p>
   * @param defaultValue The default value provided.
   * @return The long value of converted default value to Date and Time.
   */
  private long getTimeStampTypeForDefaultValue( String defaultValue ) throws ParseException {
    Date defaultTimeStamp;
    DateFormat dateFormat = new SimpleDateFormat( ValueMetaBase.DEFAULT_TIMESTAMP_PARSE_MASK );

    try {
      defaultTimeStamp = dateFormat.parse( defaultValue );
      return defaultTimeStamp.getTime();
    } catch ( ParseException pe ) {
      throw new ParseException( "The default value " + defaultValue + " should be of format : " + ValueMetaBase.DEFAULT_TIMESTAMP_PARSE_MASK, pe.getErrorOffset() );
    }
  }
}

View on GitHub (pinned to f3058517a1)