pentaho/pentaho-kettle · error · KettleStepException

TableCompareMeta.Exception.NrErrorsFieldIsNotSpecified

Error message

TableCompareMeta.Exception.NrErrorsFieldIsNotSpecified

What it means

TableCompareMeta.getFields() validates that every output field name is configured before appending output columns. This error means the 'number of errors' output field (nrErrorsField) is empty/unset, so the step cannot declare its output row structure.

Solutions

  1. Set a non-empty name for the 'nr errors field' in the TableCompare step dialog (e.g. 'nr_errors').
  2. In code, call meta.setNrErrorsField("nr_errors") before the transformation runs.
  3. Fix the .ktr XML so the <nr_errors_field> tag has a value.

Example fix

// before
TableCompareMeta meta = new TableCompareMeta();
// meta.setNrErrorsField(...) never called
// after
TableCompareMeta meta = new TableCompareMeta();
meta.setNrErrorsField( "nr_errors" );
Defensive patterns

Strategy: validation

Validate before calling

if ( meta.getNrErrorsField() == null || meta.getNrErrorsField().isEmpty() ) {
  meta.setNrErrorsField( "nr_errors" );
}

Try / catch

try {
  meta.getFields( bowl, rowMeta, origin, info, nextStep, space, repository, metaStore );
} catch ( KettleStepException e ) {
  if ( e.getMessage().contains( "NrErrorsFieldIsNotSpecified" ) ) {
    meta.setNrErrorsField( "nr_errors" );
  }
}

Prevention

When it happens

Trigger: getFields(...) is called (during transformation initialization or metadata serialization) while the nrErrorsField property is null or empty — i.e. the step was configured programmatically or via XML that omitted the nr_errors_field tag.

Common situations: Building the step metadata in code/Jenkins-generated transformations without setting all output field names; hand-edited .ktr XML missing tags; upgrading transformations where new output fields were added in later versions.

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


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/73e0af4b9c36c805. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompareMeta.java:373

  @Override
  public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException {
    readData( stepnode, databases );
  }

  @Override
  public Object clone() {
    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" ) );
    }

View on GitHub (pinned to f3058517a1)