pentaho/pentaho-kettle · error · KettleStepException
TableCompareMeta.Exception.NrRecordsCompareFieldNotSpecified
Error message
TableCompareMeta.Exception.NrRecordsCompareFieldNotSpecified
What it means
Third check in TableCompareMeta.getFields(): the 'number of records compare table' output field (nrRecordsCompareField) is not specified. Thrown after the errors-field and reference-records-field checks pass.
Solutions
- Set the 'nr records compare field' in the step dialog (e.g. 'nr_records_compare').
- In code, call meta.setNrRecordsCompareField("nr_records_compare").
- Fix the .ktr XML <nr_records_compare_field> tag.
Example fix
// before meta.setNrRecordsReferenceField( "nr_records_reference" ); // after meta.setNrRecordsReferenceField( "nr_records_reference" ); meta.setNrRecordsCompareField( "nr_records_compare" );
Defensive patterns
Strategy: validation
Validate before calling
if ( meta.getNrRecordsCompareField() == null || meta.getNrRecordsCompareField().isEmpty() ) {
meta.setNrRecordsCompareField( "nr_records_compare" );
} Try / catch
try {
meta.getFields( ... );
} catch ( KettleStepException e ) {
if ( e.getMessage().contains( "NrRecordsCompareFieldNotSpecified" ) ) {
meta.setNrRecordsCompareField( "nr_records_compare" );
}
} Prevention
- Use a checklist of the six required output fields when configuring TableCompare programmatically.
- Copy configuration from a working reference transformation.
- Validate metadata via getFields() in a smoke test before scheduling the job.
When it happens
Trigger: getFields(...) invoked with nrRecordsCompareField null/empty — thrown at TableCompareMeta.java:381.
Common situations: Programmatic metadata construction missing this setter; hand-edited .ktr XML; transformations copied from older step versions that lacked this output.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- GetTableNames.Log.NoSchemaField
- TableCompareMeta.Exception.NrRecordsReferenceFieldNotSpecifi…
- TableCompareMeta.Exception.NrErrorsInnerJoinFieldNotSpecifie…
- TableCompareMeta.Exception.NrErrorsRightJoinFieldNotSpecifie…
- TableCompareMeta.Exception.NrErrorsFieldIsNotSpecified
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/5126013f506a8000.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompareMeta.java:381
TableCompareMeta retval = (TableCompareMeta) super.clone();
return retval;
}
@Override
public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String origin, RowMetaInterface[] info,
StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {
if ( Utils.isEmpty( nrErrorsField ) ) {
throw new KettleStepException( BaseMessages.getString(
PKG, "TableCompareMeta.Exception.NrErrorsFieldIsNotSpecified" ) );
}
if ( Utils.isEmpty( nrRecordsReferenceField ) ) {
throw new KettleStepException( BaseMessages.getString(
PKG, "TableCompareMeta.Exception.NrRecordsReferenceFieldNotSpecified" ) );
}
if ( Utils.isEmpty( nrRecordsCompareField ) ) {
throw new KettleStepException( BaseMessages.getString(
PKG, "TableCompareMeta.Exception.NrRecordsCompareFieldNotSpecified" ) );
}
if ( Utils.isEmpty( nrErrorsLeftJoinField ) ) {
throw new KettleStepException( BaseMessages.getString(
PKG, "TableCompareMeta.Exception.NrErrorsLeftJoinFieldNotSpecified" ) );
}
if ( Utils.isEmpty( nrErrorsInnerJoinField ) ) {
throw new KettleStepException( BaseMessages.getString(
PKG, "TableCompareMeta.Exception.NrErrorsInnerJoinFieldNotSpecified" ) );
}
if ( Utils.isEmpty( nrErrorsRightJoinField ) ) {
throw new KettleStepException( BaseMessages.getString(
PKG, "TableCompareMeta.Exception.NrErrorsRightJoinFieldNotSpecified" ) );
}
ValueMetaInterface nrErrorsValueMeta = new ValueMetaInteger( nrErrorsField );
nrErrorsValueMeta.setLength( 9 );
nrErrorsValueMeta.setOrigin( origin );View on GitHub (pinned to f3058517a1)