pentaho/pentaho-kettle · critical · RuntimeException
: There was a data type error: the data type of " +…
Error message
: There was a data type error: the data type of " + object.getClass().getName() + " object [" + object + "] does not correspond to value meta [" + toStringMeta() + "]
What it means
A RuntimeException thrown by ValueMetaTimestamp.writeData when a ClassCastException (or KettleValueException) occurs while writing — i.e. the runtime object is not the type the value metadata declares (e.g. a String where a Timestamp is expected).
Solutions
- Align the row metadata with actual object types (use RowMetaUtil / verify with a 'Verify rows' pattern)
- Convert the value before writing: valueMeta.convertData(sourceMeta, data)
- Inspect object.getClass() at the write site and fix the producing transform
Example fix
// before row[0] = "2024-01-05 10:00:00"; // meta says Timestamp // after row[0] = tsMeta.convertData(stringMeta, row[0]); // now a Timestamp
Defensive patterns
Strategy: type-guard
Validate before calling
if (object != null && !(object instanceof java.sql.Timestamp)
&& valueMeta.getStorageType() == ValueMetaInterface.STORAGE_TYPE_NORMAL) {
object = valueMeta.convertData(dateMeta, object);
} Type guard
boolean isTimestampData(ValueMetaInterface vm, Object o) {
if (o == null) return true;
switch (vm.getStorageType()) {
case ValueMetaInterface.STORAGE_TYPE_NORMAL: return o instanceof java.sql.Timestamp;
case ValueMetaInterface.STORAGE_TYPE_INDEXED: return o instanceof Integer;
case ValueMetaInterface.STORAGE_TYPE_BINARY_STRING: return o instanceof byte[];
default: return false;
}
} Try / catch
try {
meta.writeData(out, object);
} catch (RuntimeException e) {
if (e.getMessage().contains("data type error")) {
object = meta.convertData(sourceMeta, object);
meta.writeData(out, object);
} else throw e;
} Prevention
- Keep row metadata and actual object types in sync through the whole pipeline
- Convert at transform boundaries, never assume the previous step's types
- Run pipelines in development with data-type verification enabled
When it happens
Trigger: Writing a row whose field holds a String/Date/byte[] while the meta says Timestamp with a storage type that triggers a cast, e.g. STORAGE_TYPE_INDEXED with a non-Integer object, or normal storage with a non-Timestamp object.
Common situations: Row layout drift between transforms (field type changed upstream), heterogeneous input files, incorrectly typed data injected via custom code.
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
- : There was a data type error: the data type of object []…
- BaseStep.SafeMode.Exception.MixingTypes
- ColumnExists.Exception.CouldnotFindField
- CubeInputMeta.Exception.UnableToLoadStepInfo
- Error loading transformation step from XML
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/523c36e7a56e327d.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/row/value/ValueMetaTimestamp.java:610
// 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:
throw new KettleFileException( toString() + " : Unknown storage type " + getStorageType() );
}
}
} catch ( ClassCastException e ) {
throw new RuntimeException( toString() + " : There was a data type error: the data type of "
+ object.getClass().getName() + " object [" + object + "] does not correspond to value meta ["
+ toStringMeta() + "]" );
} catch ( IOException e ) {
throw new KettleFileException( toString() + " : Unable to write value timestamp data to output stream", e );
} catch ( KettleValueException e ) {
throw new RuntimeException( toString() + " : There was a data type error: the data type of "
+ object.getClass().getName() + " object [" + object + "] does not correspond to value meta ["
+ toStringMeta() + "]" );
}
}
@Override
public Object readData( DataInputStream inputStream ) throws KettleFileException, KettleEOFException,
SocketTimeoutException {
try {
// Is the value NULL?
if ( inputStream.readBoolean() ) {
return null; // doneView on GitHub (pinned to f3058517a1)