{"record":{"id":"3bd411e99baf4ca6","repo":"pentaho/pentaho-kettle","slug":"tablecompare-exception-cannotfindfield","errorCode":null,"errorMessage":"TableCompare.Exception.CanNotFindField","messagePattern":"TableCompare\\.Exception\\.CanNotFindField","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompare.java","lineNumber":83,"sourceCode":"\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() ) );\n      }\n\n      // Compare schema\n      //\n      if ( Utils.isEmpty( meta.getCompareSchemaField() ) ) {","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/tablecompare/TableCompare.java#L65-L101","documentation":"TableCompare.processRow looks up the configured reference schema field name in the incoming row layout (getInputRowMeta().indexOfValue). If the field name is configured but not present in the input rows, it throws TableCompare.Exception.CanNotFindField naming the field.","triggerScenarios":"meta.getReferenceSchemaField() is non-empty but indexOfValue returns -1 because upstream steps don't produce a field with that exact name.","commonSituations":"Renamed or removed upstream field, case-sensitive name mismatch, or the field lives in a different stream than the one connected to the step.","solutions":["Rename the configured 'Reference schema field' to match an actual upstream field exactly (case-sensitive)","Add the field upstream (e.g. via Select values / Calculator) before Table Compare","Preview upstream rows to confirm the field name and ordering","Re-run after fixing the transformation; the step re-resolves indexes per row batch"],"exampleFix":"// before\nmeta.setReferenceSchemaField( \"Schema\" ); // upstream field is \"schema\"\n// after\nmeta.setReferenceSchemaField( \"schema\" ); // matches indexOfValue in input row meta","handlingStrategy":"validation","validationCode":"// before executing, confirm the field exists in the upstream row layout\nString f = meta.getReferenceSchemaField();\nif ( f == null || inputRowMeta.indexOfValue( f ) < 0 ) {\n  throw new IllegalArgumentException( \"Input stream has no field: \" + f );\n}","typeGuard":null,"tryCatchPattern":"try {\n  trans.execute( null );\n} catch ( KettleException e ) {\n  if ( e.getMessage().contains( \"CanNotFindField\" ) ) {\n    logError( \"Field missing in input stream; check upstream steps\" );\n  }\n}","preventionTips":["Preview the input stream and copy field names exactly","Remember field lookups are case-sensitive","Re-check configuration after renaming upstream steps","Use a Select values step to pin required field names before Table Compare"],"tags":["configuration","field-lookup","table-compare"],"backgroundTag":"resource-not-found","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"}