pentaho/pentaho-kettle · error · KettleValueException

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

Error message

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

What it means

Kettle's ValueMetaBase.getDate() cannot convert a value whose metadata type is TYPE_SERIALIZABLE into a java.util.Date. Date conversion is only defined for string, number, integer, bignumber and date-typed values; any other declared type is refused with KettleValueException rather than producing a wrong date. The message is prefixed with the field's toString() so you can identify which field failed.

Solutions

  1. Fix the producing step so the field's value metadata declares TYPE_DATE and stores a Date object instead of a serializable object.
  2. Insert an explicit conversion step that turns the object into a String/long first, then a Select Values type conversion to Date.
  3. Catch KettleValueException around the getDate() call and handle non-date fields explicitly.
  4. Use cloneToValueMeta/convertData with a TYPE_DATE value meta instead of calling getDate() directly on the serializable meta.

Example fix

// before
ValueMetaInterface vm = new ValueMeta("obj", ValueMetaInterface.TYPE_SERIALIZABLE);
Date d = vm.getDate(rowData[0]); // throws
// after
ValueMetaInterface vmDate = new ValueMeta("obj", ValueMetaInterface.TYPE_DATE);
Date d = (Date) vm.convertData(vm, rowData[0]);
Defensive patterns

Strategy: type-guard

Validate before calling

if (meta.getType() == ValueMetaInterface.TYPE_SERIALIZABLE) { throw new IllegalArgumentException("Field " + meta.getName() + " is serializable; cannot getDate()"); }

Type guard

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

Try / catch

try { Date d = vm.getDate(value); } catch (KettleValueException e) { log.warn("Not a date-convertible field: " + e.getMessage()); }

Prevention

When it happens

Trigger: Calling getDate(object) (or a step that requests a Date from a field, e.g. via getRow with date output) on a value meta whose type is ValueMetaInterface.TYPE_SERIALIZABLE, typically because a plugin or user-defined Java class step produced a serializable object field.

Common situations: User Defined Java Class / scripting steps emitting raw Java objects into the row stream; custom plugins producing serializable fields that downstream steps try to read as dates; field type changed upstream after a version upgrade.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


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

Appendix: source

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

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

View on GitHub (pinned to f3058517a1)