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_DATE_PARSE_MASK

What it means

ParseException re-thrown by PentahoAvroOutputFormat.getDateTypeForDefaultValue when the default value string cannot be parsed using ValueMetaBase.DEFAULT_DATE_PARSE_MASK (yyyy/MM/dd HH:mm:ss). The method converts a date string to epoch days for DATE-typed Avro fields.

Solutions

  1. Set the default value to a string matching ValueMetaBase.DEFAULT_DATE_PARSE_MASK (e.g. '2024/12/31 00:00:00')
  2. Normalize user-supplied dates with a permissive parser first, then format into the expected mask
  3. Check for trailing whitespace or locale characters in the stored default value
  4. Remove the default if the field does not need one
  5. Note the inner exception's error offset to find exactly where the string stopped parsing

Example fix

// before
field.setDefault( "2024-12-31" );
// after
field.setDefault( "2024/12/31 00:00:00" ); // matches DEFAULT_DATE_PARSE_MASK
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

boolean isValidDateDefault( 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 { int epochDay = getDateTypeForDefaultValue( defaultValue ); }
catch ( ParseException pe ) { throw new IllegalArgumentException( "Use format yyyy/MM/dd HH:mm:ss for date defaults: " + defaultValue ); }

Prevention

When it happens

Trigger: mapDefaultValuesToDataTypes dispatches a DATE field to getDateTypeForDefaultValue and dateFormat.parse(defaultValue) fails — the string is not in the expected date parse mask, or is empty/garbage.

Common situations: Entering a date like '12/31/2024' or '2024-12-31' when the mask expects 'yyyy/MM/dd HH:mm:ss'; leaving the default blank; regional date-order assumptions (dd/MM vs MM/dd); hand-editing transformation XML with an unparseable default.

Related errors


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

Appendix: source

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

   * @see org.pentaho.di.trans.steps.avro.AvroToPdiConverter #convertToPentahoType(int, String, IAvroInputField)
   * </P>
   *
   * <p>
   * @param defaultValue The default value provided.
   * @return The integer value of converted default value to Date.
   */
  private int getDateTypeForDefaultValue( String defaultValue ) throws ParseException {
    Date defaultDate;
    DateFormat dateFormat = new SimpleDateFormat( ValueMetaBase.DEFAULT_DATE_PARSE_MASK );

    try {
      defaultDate = dateFormat.parse( defaultValue );
      LocalDate localDate = defaultDate.toInstant()
              .atZone( ZoneId.systemDefault() )
              .toLocalDate();
      return (int) localDate.toEpochDay();
    } catch ( ParseException pe ) {
      throw new ParseException( "The default value " + defaultValue + " should be of format : " + ValueMetaBase.DEFAULT_DATE_PARSE_MASK, pe.getErrorOffset() );
    }

  }

  /**
   * Converts the default value to TimeStamp(in Milliseconds).
   *
   * <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 {

View on GitHub (pinned to f3058517a1)