pentaho/pentaho-kettle · error · RuntimeException
: There was a data type error: the data type of object []…
Error message
: There was a data type error: the data type of object [] does not correspond to value meta []
What it means
RuntimeException thrown inside ValueMetaBase.writeData when an indexed (STORAGE_TYPE_INDEXED) value's element raises ClassCastException during serialization: the element's class does not match the declared index element type. Unlike error 470 this surfaces as a raw RuntimeException because it is thrown from within the per-index-element catch block.
Solutions
- Normalize all index entries to the exact class expected by the value meta's type before writing
- Build the indexed ValueMeta with ValueMetaFactory/clone from a correctly typed prototype
- Log index position i and the offending class to locate the producer of the wrong-typed entry
Example fix
// before
index[i] = Long.valueOf(5); // meta declares TYPE_INTEGER (expects Integer)
// after
if (!(index[i] instanceof Integer)) {
index[i] = Integer.valueOf(((Number) index[i]).intValue());
} Defensive patterns
Strategy: type-guard
Validate before calling
// Check each index entry's class against the declared type before writeData:
static boolean indexEntriesMatchType(ValueMetaInterface vmi, Object[] index) {
Class<?> expected = expectedClassFor(vmi.getType());
for (Object o : index) {
if (o != null && !expected.isInstance(o)) return false;
}
return true;
} Type guard
static Object normalizeIndexEntry(ValueMetaInterface vmi, Object o) {
if (o == null) return null;
switch (vmi.getType()) {
case ValueMetaInterface.TYPE_STRING: return o instanceof String ? o : String.valueOf(o);
case ValueMetaInterface.TYPE_INTEGER: return o instanceof Long ? o : Long.valueOf(((Number) o).longValue());
case ValueMetaInterface.TYPE_NUMBER: return o instanceof Double ? o : Double.valueOf(((Number) o).doubleValue());
default: return o;
}
} Try / catch
try {
valueMeta.writeData(out, object);
} catch (RuntimeException e) {
if (String.valueOf(e.getMessage()).contains("data type error")) {
LOG.error("Indexed field " + valueMeta.getName() + ": entry class mismatch - " + e.getMessage());
// rebuild the index array with normalized entries, then retry
} else { throw e; }
} Prevention
- Populate index arrays from a single typed source; never mix Integer/Long or Date/Timestamp entries
- Normalize entries with a shared converter when building indexed value metas
- Catch RuntimeException, not just KettleFileException, when writing indexed values — this path throws unchecked
- Add a round-trip serialization test for each indexed lookup table in your transformations
When it happens
Trigger: writeData() on an indexed value meta where an index entry fails casts like (String), (Double), (Long), (Date), (Boolean), (byte[]) imposed by the index element's declared type.
Common situations: Index arrays built with mixed classes (e.g., Long and Integer mixed); lookup tables populated from queries returning different numeric types than declared; custom plugin code filling the index without conversion.
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
- : Unable to serialize indexe storage type for data type
- Unexpected conversion error while converting value [" +…
- CubeInputMeta.Exception.UnableToLoadStepInfo
- Error loading transformation step from XML
- Error loading transformation step from XML
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/1adc2c372dbea091.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java:3017
break;
case TYPE_DATE:
writeDate( outputStream, (Date) index[i] );
break;
case TYPE_BIGNUMBER:
writeBigNumber( outputStream, (BigDecimal) index[i] );
break;
case TYPE_BOOLEAN:
writeBoolean( outputStream, (Boolean) index[i] );
break;
case TYPE_BINARY:
writeBinary( outputStream, (byte[]) index[i] );
break;
default:
throw new KettleFileException( toString()
+ " : Unable to serialize indexe storage type for data type " + getType() );
}
} catch ( ClassCastException e ) {
throw new RuntimeException( toString() + " : There was a data type error: the data type of "
+ index[i].getClass().getName() + " object [" + index[i] + "] does not correspond to value meta ["
+ toStringMeta() + "]" );
}
}
}
break;
case STORAGE_TYPE_BINARY_STRING:
// Save the storage meta data...
//
outputStream.writeBoolean( storageMetadata != null );
if ( storageMetadata != null ) {
storageMetadata.writeMeta( outputStream );
}
break;
default:View on GitHub (pinned to f3058517a1)