{"record":{"id":"5126013f506a8000","repo":"pentaho/pentaho-kettle","slug":"tablecomparemeta-exception-nrrecordscomparefieldnotspecified","errorCode":null,"errorMessage":"TableCompareMeta.Exception.NrRecordsCompareFieldNotSpecified","messagePattern":"TableCompareMeta\\.Exception\\.NrRecordsCompareFieldNotSpecified","errorType":"validation","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompareMeta.java","lineNumber":381,"sourceCode":"    TableCompareMeta retval = (TableCompareMeta) super.clone();\n\n    return retval;\n  }\n\n  @Override\n  public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String origin, RowMetaInterface[] info,\n    StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {\n\n    if ( Utils.isEmpty( nrErrorsField ) ) {\n      throw new KettleStepException( BaseMessages.getString(\n        PKG, \"TableCompareMeta.Exception.NrErrorsFieldIsNotSpecified\" ) );\n    }\n    if ( Utils.isEmpty( nrRecordsReferenceField ) ) {\n      throw new KettleStepException( BaseMessages.getString(\n        PKG, \"TableCompareMeta.Exception.NrRecordsReferenceFieldNotSpecified\" ) );\n    }\n    if ( Utils.isEmpty( nrRecordsCompareField ) ) {\n      throw new KettleStepException( BaseMessages.getString(\n        PKG, \"TableCompareMeta.Exception.NrRecordsCompareFieldNotSpecified\" ) );\n    }\n    if ( Utils.isEmpty( nrErrorsLeftJoinField ) ) {\n      throw new KettleStepException( BaseMessages.getString(\n        PKG, \"TableCompareMeta.Exception.NrErrorsLeftJoinFieldNotSpecified\" ) );\n    }\n    if ( Utils.isEmpty( nrErrorsInnerJoinField ) ) {\n      throw new KettleStepException( BaseMessages.getString(\n        PKG, \"TableCompareMeta.Exception.NrErrorsInnerJoinFieldNotSpecified\" ) );\n    }\n    if ( Utils.isEmpty( nrErrorsRightJoinField ) ) {\n      throw new KettleStepException( BaseMessages.getString(\n        PKG, \"TableCompareMeta.Exception.NrErrorsRightJoinFieldNotSpecified\" ) );\n    }\n\n    ValueMetaInterface nrErrorsValueMeta = new ValueMetaInteger( nrErrorsField );\n    nrErrorsValueMeta.setLength( 9 );\n    nrErrorsValueMeta.setOrigin( origin );","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompareMeta.java#L363-L399","documentation":"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.","triggerScenarios":"getFields(...) invoked with nrRecordsCompareField null/empty — thrown at TableCompareMeta.java:381.","commonSituations":"Programmatic metadata construction missing this setter; hand-edited .ktr XML; transformations copied from older step versions that lacked this output.","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."],"exampleFix":"// before\nmeta.setNrRecordsReferenceField( \"nr_records_reference\" );\n// after\nmeta.setNrRecordsReferenceField( \"nr_records_reference\" );\nmeta.setNrRecordsCompareField( \"nr_records_compare\" );","handlingStrategy":"validation","validationCode":"if ( meta.getNrRecordsCompareField() == null || meta.getNrRecordsCompareField().isEmpty() ) {\n  meta.setNrRecordsCompareField( \"nr_records_compare\" );\n}","typeGuard":null,"tryCatchPattern":"try {\n  meta.getFields( ... );\n} catch ( KettleStepException e ) {\n  if ( e.getMessage().contains( \"NrRecordsCompareFieldNotSpecified\" ) ) {\n    meta.setNrRecordsCompareField( \"nr_records_compare\" );\n  }\n}","preventionTips":["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."],"tags":["kettle","configuration","validation","missing-field"],"backgroundTag":"empty-required-field","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}