pentaho/pentaho-kettle · error · KettleValueException

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

Error message

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

What it means

ValueMetaBase.getDate(Object) throws this KettleValueException when the field's type is TYPE_BINARY. PDI has no rule for interpreting a raw byte[] as a Date (no implicit parsing/decoding), so it throws instead of returning garbage. The message includes the field's toString() so the offending field can be identified.

Solutions

  1. Fix the field mapping so a Date/String/Number/Integer/BigNumber field feeds the getDate call.
  2. Change the field's value type to TYPE_DATE (or TYPE_STRING with a conversion mask) and provide the bytes in a parsable form.
  3. Catch KettleValueException and decode/parse the binary content yourself (e.g. new String(bytes) then ConvertStringToDate).

Example fix

// before
Date d = binaryMeta.getDate( row[i] ); // TYPE_BINARY -> throws
// after
stringMeta.setValueType( ValueMetaInterface.TYPE_STRING ); // hold e.g. "2024-01-15" text
Date d = stringMeta.getDate( new String( (byte[]) row[i] ) );
Defensive patterns

Strategy: type-guard

Validate before calling

if ( valueMeta.getType() == ValueMetaInterface.TYPE_BINARY ) {
  throw new IllegalArgumentException( "Field " + valueMeta.getName() + " is BINARY; 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( "Binary field " + valueMeta.getName() + " cannot be read as date" );
  // decode bytes and parse manually if appropriate
}

Prevention

When it happens

Trigger: Calling getDate(object) on a field declared TYPE_BINARY (e.g. new ValueMetaBinary(...), image/file content columns, or database BLOBs mapped as Binary) — especially when such a column is wired to a Date-typed target or read with row.getDate(index).

Common situations: Binary/BLOB columns accidentally mapped to Date output fields; metadata edits changing a Date field to Binary while downstream steps still call getDate; custom step code that doesn't check getType() before reading.

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/0c13026bbd3048a5. Report an issue: GitHub.

Appendix: source

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

            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 ) {
          case STORAGE_TYPE_NORMAL:
            return (byte[]) object;

View on GitHub (pinned to f3058517a1)