{"record":{"id":"a92696d9c0909257","repo":"pentaho/pentaho-kettle","slug":"tablecompare-exception-referenceschemanotspecified","errorCode":null,"errorMessage":"TableCompare.Exception.ReferenceSchemaNotSpecified","messagePattern":"TableCompare\\.Exception\\.ReferenceSchemaNotSpecified","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompare.java","lineNumber":78,"sourceCode":"    if ( r == null ) { // no more input to be expected...\n\n      setOutputDone();\n      return false;\n    }\n\n    if ( first ) {\n      first = false;\n\n      // What's the format of the output row?\n      //\n      data.outputRowMeta = getInputRowMeta().clone();\n      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n        metaStore );\n\n      // Reference schema\n      //\n      if ( Utils.isEmpty( meta.getReferenceSchemaField() ) ) {\n        throw new KettleException( BaseMessages.getString(\n          PKG, \"TableCompare.Exception.ReferenceSchemaNotSpecified\" ) );\n      }\n      data.refSchemaIndex = getInputRowMeta().indexOfValue( meta.getReferenceSchemaField() );\n      if ( data.refSchemaIndex < 0 ) {\n        throw new KettleException( BaseMessages.getString( PKG, \"TableCompare.Exception.CanNotFindField\", meta\n          .getReferenceSchemaField() ) );\n      }\n\n      // Reference table\n      //\n      if ( Utils.isEmpty( meta.getReferenceTableField() ) ) {\n        throw new KettleException( BaseMessages.getString(\n          PKG, \"TableCompare.Exception.ReferenceTableNotSpecified\" ) );\n      }\n      data.refTableIndex = getInputRowMeta().indexOfValue( meta.getReferenceTableField() );\n      if ( data.refTableIndex < 0 ) {\n        throw new KettleException( BaseMessages.getString( PKG, \"TableCompare.Exception.CanNotFindField\", meta\n          .getReferenceTableField() ) );","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompare.java#L60-L96","documentation":"TableCompare.processRow validates its required input fields before comparing two tables. When the reference schema field name configured in the step metadata is empty, it throws a localized KettleException (TableCompare.Exception.ReferenceSchemaNotSpecified) because it cannot locate which incoming row field holds the reference schema.","triggerScenarios":"processRow runs with meta.getReferenceSchemaField() empty — the step was configured without the 'Reference schema field' setting, or the setting was lost/cleared in the transformation metadata.","commonSituations":"Building the step programmatically without setting referenceSchemaField, importing an old transformation where the option was never filled, or a metadata-injection run leaving the field unmapped.","solutions":["Open the Table Compare step dialog and set the 'Reference schema field' to a field present in the input stream","If injecting metadata, map the referenceSchemaField key to a non-empty source column","Re-save the transformation to persist the field name","Add a Select values / validation step upstream to guarantee the field exists"],"exampleFix":"// before\nTableCompareMeta meta = new TableCompareMeta();\nmeta.setReferenceSchemaField( null ); // throws at runtime\n// after\nmeta.setReferenceSchemaField( \"ref_schema\" ); // non-empty input field name","handlingStrategy":"validation","validationCode":"// before running the transformation, assert the setting exists\nif ( meta.getReferenceSchemaField() == null || meta.getReferenceSchemaField().isEmpty() ) {\n  throw new IllegalArgumentException( \"Reference schema field must be set on TableCompareMeta\" );\n}","typeGuard":"boolean hasReferenceSchemaField( TableCompareMeta m ) {\n  return m != null && m.getReferenceSchemaField() != null && !m.getReferenceSchemaField().isEmpty();\n}","tryCatchPattern":"try {\n  trans.execute( null );\n} catch ( KettleException e ) {\n  if ( e.getMessage().contains( \"ReferenceSchemaNotSpecified\" ) ) {\n    logError( \"Configure the Table Compare reference schema field before running\" );\n  }\n}","preventionTips":["Always fill all four field settings (ref schema/table, cmp schema/table) in the dialog","Set the fields programmatically right after constructing TableCompareMeta","Use metadata injection templates that include all four keys","Save the transformation and reopen it to confirm settings persisted"],"tags":["configuration","missing-field","table-compare"],"backgroundTag":"missing-required-argument","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"}