pentaho/pentaho-kettle · error · KettleValueException

: I don't know how to convert serializable values to…

Error message

 : I don't know how to convert serializable values to numbers.

What it means

ValueMetaBase.getNumber() throws this KettleValueException when the value metadata type is TYPE_SERIALIZABLE, i.e. the field holds an arbitrary Java Serializable object. Kettle has no generic mapping from an unknown Serializable object to a Double, so it refuses the conversion. The object must be narrowed to a concrete numeric/string type by the caller first.

Solutions

  1. Cast/narrow the Serializable object to its concrete class (e.g. Long, Double, String) and convert that explicitly before calling getNumber().
  2. Replace the field's value metadata with the concrete real type (ValueMetaInteger/ValueMetaNumber) via a metadata/Select-values step so standard conversions apply.
  3. If the Serializable wraps data you own, extract the numeric field from the object and put that in the row.
  4. Catch KettleValueException and handle Serializable-typed columns separately in your row-processing code.

Example fix

// before
ValueMetaInterface meta = new ValueMetaBase("obj", ValueMetaInterface.TYPE_SERIALIZABLE);
Double n = meta.getNumber(rowData[0]); // throws

// after
Object raw = rowData[0];
Double n = (raw instanceof Number) ? ((Number) raw).doubleValue() : null;
Defensive patterns

Strategy: type-guard

Validate before calling

if (meta.getType() == ValueMetaInterface.TYPE_SERIALIZABLE) {
  throw new IllegalArgumentException("Field '" + meta.getName() + "' is SERIALIZABLE; narrow to a concrete type first");
}

Type guard

boolean isSerializable(ValueMetaInterface m) {
  return m.getType() == ValueMetaInterface.TYPE_SERIALIZABLE;
}

Try / catch

try {
  Double n = meta.getNumber(value);
} catch (KettleValueException e) {
  log.warn("SERIALIZABLE field " + meta.getName() + " cannot be converted to Number", e);
}

Prevention

When it happens

Trigger: Calling ValueMeta.getNumber(Object) on a field whose valueMeta.getType() == ValueMetaInterface.TYPE_SERIALIZABLE (data is typically a java.lang.Object / Serializable instance).

Common situations: Streaming custom Java objects through transformations (e.g. job entries, user-defined Java class step outputs); Kettle internal fields such as batch/container objects marked Serializable; plugin code that copies rows into Number columns without converting the Serializable payload.

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/3422d932c98ff073. Report an issue: GitHub.

Appendix: source

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

              return new Double( ( (BigDecimal) index[( (Integer) object ).intValue()] ).doubleValue() );
            default:
              throw new KettleValueException( toString() + " : Unknown storage type " + storageType + " specified." );
          }
        case TYPE_BOOLEAN:
          switch ( storageType ) {
            case STORAGE_TYPE_NORMAL:
              return convertBooleanToNumber( (Boolean) object );
            case STORAGE_TYPE_BINARY_STRING:
              return convertBooleanToNumber( (Boolean) convertBinaryStringToNativeType( (byte[]) object ) );
            case STORAGE_TYPE_INDEXED:
              return convertBooleanToNumber( (Boolean) index[( (Integer) object ).intValue()] );
            default:
              throw new KettleValueException( toString() + " : Unknown storage type " + storageType + " specified." );
          }
        case TYPE_BINARY:
          throw new KettleValueException( toString() + " : I don't know how to convert binary values to numbers." );
        case TYPE_SERIALIZABLE:
          throw new KettleValueException( toString() + " : I don't know how to convert serializable values to numbers." );
        default:
          throw new KettleValueException( toString() + " : Unknown type " + type + " specified." );
      }
    } catch ( Exception e ) {
      throw new KettleValueException( "Unexpected conversion error while converting value [" + toString()
          + "] to a Number", e );
    }
  }

  @Override
  public Long getInteger( Object object ) throws KettleValueException {
    try {
      if ( isNull( object ) ) {
        return null;
      }
      switch ( type ) {
        case TYPE_INTEGER:
          switch ( storageType ) {

View on GitHub (pinned to f3058517a1)