pentaho/pentaho-kettle · error · RuntimeException
Row metadata and data: unable to calculate hashcode because…
Error message
Row metadata and data: unable to calculate hashcode because of a data conversion problem
What it means
RowMetaAndData.hashCode() delegates to rowMeta.hashCode(data), which computes a hash from the row's values. A KettleValueException there means a value could not be converted/hashed consistently with its metadata; the method rethrows it as a RuntimeException (hashCode cannot throw checked exceptions).
Solutions
- Fix the metadata/data mismatch so each value matches its declared ValueMeta type
- Inspect the cause KettleValueException to find the offending field/index
- Avoid using rows with custom/unconvertible values as hash keys; compare explicitly with rowMeta.compare instead
- Rebuild the row using ValueDataUtil conversions before hashing
Example fix
// before
Set<RowMetaAndData> seen = new HashSet<>();
seen.add(rowMetaAndData); // hashCode() may throw
// after
if (canHash(rowMetaAndData)) {
seen.add(rowMetaAndData);
} else {
compareExplicitly(rowMetaAndData, seenRows); // rowMeta.compare based
} Defensive patterns
Strategy: try-catch
Validate before calling
// pre-validate values are hashable per metadata
for (int i = 0; i < rmad.getRowMeta().size(); i++) {
try {
rmad.getRowMeta().getValueMeta(i).getNativeDataType(rmad.getData()[i]);
} catch (KettleValueException e) {
throw new IllegalStateException("Unhashable value at index " + i, e);
}
} Try / catch
try {
seen.add(rmad);
} catch (RuntimeException e) {
// fall back to explicit rowMeta.compare based dedup instead of hashing
} Prevention
- Avoid rows with metadata/value mismatches in hashed collections
- Prefer rowMeta.compare for row equality instead of hashCode
- Rebuild rows with proper ValueMeta conversions before adding to sets/maps
When it happens
Trigger: Adding a RowMetaAndData to a HashSet/HashMap (triggering hashCode) when a field's value cannot be hashed per its ValueMeta — e.g. incompatible value type, malformed date/binary data, or metadata/data mismatch.
Common situations: Using RowMetaAndData objects as map keys or in sets during row comparison/join logic, rows constructed with wrong types vs declared metadata, custom ValueMeta converters throwing during hashing.
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
- Problem with clone row detected in RowMetaAndData
- A cannot have a nully value.
- AnalyticQueryMeta.Exception.SubjectFieldNotFound
- BaseStep.Exception.MetadataDoesntMatchDataRowSize
- BaseStep.SafeMode.Exception.DoubleFieldnames
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/99583219174bd4db.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/RowMetaAndData.java:107
*/
public RowMetaInterface getRowMeta() {
return rowMeta;
}
/**
* @param rowMeta
* the rowMeta to set
*/
public void setRowMeta( RowMetaInterface rowMeta ) {
this.rowMeta = rowMeta;
}
@Override
public int hashCode() {
try {
return rowMeta.hashCode( data );
} catch ( KettleValueException e ) {
throw new RuntimeException(
"Row metadata and data: unable to calculate hashcode because of a data conversion problem", e );
}
}
@Override
public boolean equals( Object obj ) {
try {
return rowMeta.compare( data, ( (RowMetaAndData) obj ).getData() ) == 0;
} catch ( KettleValueException e ) {
throw new RuntimeException(
"Row metadata and data: unable to compare rows because of a data conversion problem", e );
}
}
public void addValue( ValueMetaInterface valueMeta, Object valueData ) {
if ( valueMeta.isInteger() && ( valueData instanceof ObjectId ) ) {
valueData = new LongObjectId( (ObjectId) valueData ).longValue();
}View on GitHub (pinned to f3058517a1)