pentaho/pentaho-kettle · error · KettleValueException

: I don't know how to convert a boolean to a date.

Error message

 : I don't know how to convert a boolean to a date.

What it means

ValueMetaBase.getDate(Object) throws this KettleValueException when the field's type is TYPE_BOOLEAN. PDI defines no boolean-to-date conversion — there is no meaningful mapping from true/false to a Date — so it fails fast instead of inventing one. The message is prefixed with the field's toString() (name and type metadata).

Solutions

  1. Correct the field mapping so a Date-typed (or String/Number/Integer/BigNumber) field feeds the getDate call.
  2. Change the field's value type to TYPE_DATE (or a convertible type) with an explicit conversion if a boolean really must become a date.
  3. Catch KettleValueException and handle the Boolean field explicitly (e.g. map true/false to fixed dates in your own code).

Example fix

// before
Date d = valueMeta.getDate( row[i] ); // valueMeta is TYPE_BOOLEAN -> throws
// after
if ( valueMeta.getType() == ValueMetaInterface.TYPE_BOOLEAN ) {
  Date d = Boolean.TRUE.equals( valueMeta.getBoolean( row[i] ) ) ? activeDate : inactiveDate;
} else {
  Date d = valueMeta.getDate( row[i] );
}
Defensive patterns

Strategy: type-guard

Validate before calling

if ( valueMeta.getType() == ValueMetaInterface.TYPE_BOOLEAN ) {
  throw new IllegalArgumentException( "Field " + valueMeta.getName() + " is BOOLEAN; cannot read as Date" );
}

Type guard

boolean readableAsDate( ValueMetaInterface vm ) {
  int t = vm.getType();
  return t == ValueMetaInterface.TYPE_DATE || t == ValueMetaInterface.TYPE_STRING
      || t == ValueMetaInterface.TYPE_INTEGER || t == ValueMetaInterface.TYPE_NUMBER
      || t == ValueMetaInterface.TYPE_BIGNUMBER;
}

Try / catch

try {
  Date d = valueMeta.getDate( row[i] );
} catch ( KettleValueException e ) {
  logError( "Cannot read " + valueMeta.getName() + " as date: " + e.getMessage() );
  // map the boolean to a date explicitly or skip the field
}

Prevention

When it happens

Trigger: Calling getDate(object) (directly or via RowMeta.getDate/row getters) on a field declared as Boolean, e.g. new ValueMetaBoolean(...) or a Boolean column feeding a Date-typed target in the transformation.

Common situations: Mapping mistakes where a Boolean flag column is wired to a Date output field; metadata edits that changed a Date field to Boolean while downstream steps still request dates; custom step code reading fields without checking getType().

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java:2361

            return convertIntegerToDate( (Long) convertBinaryStringToNativeType( (byte[]) object ) );
          case STORAGE_TYPE_INDEXED:
            return convertIntegerToDate( (Long) index[( (Integer) object ).intValue()] );
          default:
            throw new KettleValueException( toString() + " : Unknown storage type " + storageType + " specified." );
        }
      case TYPE_BIGNUMBER:
        switch ( storageType ) {
          case STORAGE_TYPE_NORMAL:
            return convertBigNumberToDate( (BigDecimal) object );
          case STORAGE_TYPE_BINARY_STRING:
            return convertBigNumberToDate( (BigDecimal) convertBinaryStringToNativeType( (byte[]) object ) );
          case STORAGE_TYPE_INDEXED:
            return convertBigNumberToDate( (BigDecimal) index[( (Integer) object ).intValue()] );
          default:
            throw new KettleValueException( toString() + " : Unknown storage type " + storageType + " specified." );
        }
      case TYPE_BOOLEAN:
        throw new KettleValueException( toString() + " : I don't know how to convert a boolean to a date." );
      case TYPE_BINARY:
        throw new KettleValueException( toString() + " : I don't know how to convert a binary value to date." );
      case TYPE_SERIALIZABLE:
        throw new KettleValueException( toString() + " : I don't know how to convert a serializable value to date." );

      default:
        throw new KettleValueException( toString() + " : Unknown type " + type + " specified." );
    }
  }

  @Override
  public byte[] getBinary( Object object ) throws KettleValueException {
    if ( object == null ) {
      return null;
    }
    switch ( type ) {
      case TYPE_BINARY:
        switch ( storageType ) {

View on GitHub (pinned to f3058517a1)