pentaho/pentaho-kettle · error · KettleFileException

: Unable to serialize data type " + getType()

Error message

 : Unable to serialize data type " + getType()

What it means

KettleFileException thrown by ValueMetaBase.writeData when the value's storage type is STORAGE_TYPE_NORMAL but getType() does not match any of the cases handled by the serialization switch (String, Number, Integer, Date, Boolean, Binary, Big Number, InetAddress, etc.). It means the value data type is unknown to the binary serialization writer.

Solutions

  1. Avoid serializing rows with TYPE_SERIALIZABLE fields using writeData; store such data differently or convert to a supported type
  2. Upgrade all nodes in the cluster to the same Pentaho/Kettle version so type constants match
  3. Validate getType() before serialization and convert unsupported types to supported ones (e.g., TIMESTAMP to Date if on an older version)

Example fix

// before
valueMeta.writeData(outputStream, object); // valueMeta type is TYPE_SERIALIZABLE
// after
if (valueMeta.getType() == ValueMetaInterface.TYPE_SERIALIZABLE) {
  valueMeta = valueMeta.clone(); valueMeta.setType(ValueMetaInterface.TYPE_STRING);
}
valueMeta.writeData(outputStream, object);
Defensive patterns

Strategy: validation

Validate before calling

// Before serializing a row over Kettle's binary protocol:
static void assertWritableType(ValueMetaInterface vmi) throws KettleFileException {
  switch (vmi.getType()) {
    case ValueMetaInterface.TYPE_STRING:
    case ValueMetaInterface.TYPE_NUMBER:
    case ValueMetaInterface.TYPE_INTEGER:
    case ValueMetaInterface.TYPE_DATE:
    case ValueMetaInterface.TYPE_BOOLEAN:
    case ValueMetaInterface.TYPE_BIGNUMBER:
    case ValueMetaInterface.TYPE_BINARY:
    case ValueMetaInterface.TYPE_INET:
      return; // supported by writeData
    default:
      throw new KettleFileException("Type " + vmi.getType() + " on '" + vmi.getName() + "' is not serializable by writeData");
  }
}

Try / catch

try {
  valueMeta.writeData(out, object);
} catch (KettleFileException e) {
  if (String.valueOf(e.getMessage()).contains("Unable to serialize data type")) {
    // convert field to a supported type or drop it before retry
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling writeData() on a ValueMeta whose type is a valid internal type like TYPE_SERIALIZABLE, TYPE_TIMESTAMP (on older versions), or a custom/unknown type not covered by the writer's switch default branch.

Common situations: Clustering or streaming rows containing Serializable/Java-object fields over Kettle's binary protocol; using a value type added in a newer Pentaho version against an older writer; corrupt metadata where type constants were set programmatically to out-of-range values.

Related errors


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

Appendix: source

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

                writeInteger( outputStream, (Long) object );
                break;
              case TYPE_DATE:
                writeDate( outputStream, (Date) object );
                break;
              case TYPE_BIGNUMBER:
                writeBigNumber( outputStream, (BigDecimal) object );
                break;
              case TYPE_BOOLEAN:
                writeBoolean( outputStream, (Boolean) object );
                break;
              case TYPE_BINARY:
                writeBinary( outputStream, (byte[]) object );
                break;
              case TYPE_INET:
                writeBinary( outputStream, ( (InetAddress) object ).getAddress() );
                break;
              default:
                throw new KettleFileException( toString() + " : Unable to serialize data type " + getType() );
            }
            break;

          case STORAGE_TYPE_BINARY_STRING:
            // Handle binary string content -- only when not NULL
            // In this case, we opt not to convert anything at all for speed.
            // That way, we can save on CPU power.
            // Since the streams can be compressed, volume shouldn't be an issue
            // at all.
            //
            writeBinaryString( outputStream, (byte[]) object );
            break;

          case STORAGE_TYPE_INDEXED:
            writeInteger( outputStream, (Integer) object ); // just an index
            break;

          default:

View on GitHub (pinned to f3058517a1)