{"record":{"id":"1a4e5565ecdcdb78","repo":"pentaho/pentaho-kettle","slug":"fieldschangesequence-log-cannotfindfield","errorCode":null,"errorMessage":"FieldsChangeSequence.Log.CanNotFindField","messagePattern":"FieldsChangeSequence\\.Log\\.CanNotFindField","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/fieldschangesequence/FieldsChangeSequence.java","lineNumber":78,"sourceCode":"    if ( first ) {\n      // get the RowMeta\n      data.previousMeta = getInputRowMeta().clone();\n      data.nextIndexField = data.previousMeta.size();\n      data.outputRowMeta = getInputRowMeta().clone();\n      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n        metaStore );\n\n      if ( meta.getFieldName() == null || meta.getFieldName().length > 0 ) {\n        data.fieldnr = meta.getFieldName().length;\n        data.fieldnrs = new int[data.fieldnr];\n        data.previousValues = new Object[data.fieldnr];\n        data.fieldnrsMeta = new ValueMetaInterface[data.fieldnr];\n        for ( int i = 0; i < data.fieldnr; i++ ) {\n          data.fieldnrs[i] = data.previousMeta.indexOfValue( meta.getFieldName()[i] );\n          if ( data.fieldnrs[i] < 0 ) {\n            logError( BaseMessages.getString(\n              PKG, \"FieldsChangeSequence.Log.CanNotFindField\", meta.getFieldName()[i] ) );\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"FieldsChangeSequence.Log.CanNotFindField\", meta.getFieldName()[i] ) );\n          }\n          data.fieldnrsMeta[i] = data.previousMeta.getValueMeta( data.fieldnrs[i] );\n        }\n      } else {\n        data.fieldnr = data.previousMeta.size();\n        data.fieldnrs = new int[data.fieldnr];\n        data.previousValues = new Object[data.fieldnr];\n        data.fieldnrsMeta = new ValueMetaInterface[data.fieldnr];\n        for ( int i = 0; i < data.previousMeta.size(); i++ ) {\n          data.fieldnrs[i] = i;\n          data.fieldnrsMeta[i] = data.previousMeta.getValueMeta( i );\n        }\n      }\n\n      data.startAt = Const.toInt( environmentSubstitute( meta.getStart() ), 1 );\n      data.incrementBy = Const.toInt( environmentSubstitute( meta.getIncrement() ), 1 );\n      data.seq = data.startAt;","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/fieldschangesequence/FieldsChangeSequence.java#L60-L96","documentation":"KettleException thrown by FieldsChangeSequence.processRow() when one of the configured field names cannot be found in the incoming row's metadata (indexOfValue returns < 0). The field name is logged via logError first, then thrown. This step computes a sequence based on changes in the specified fields, so all must exist in the stream.","triggerScenarios":"data.previousMeta.indexOfValue(meta.getFieldName()[i]) returns -1 during processRow() because a field configured in the step dialog (or via setFieldName) is not present in the input row.","commonSituations":"Upstream field renamed or removed; step configured with fields from a different stream; programmatically built transformation passing stale field names; case-sensitivity mismatch.","solutions":["Open the Fields change sequence step and re-select the field names from the current incoming stream.","Add a Select values step upstream to produce/rename the missing fields.","Programmatically, ensure meta.setFieldName(new String[]{...}) lists fields that actually exist in the previous step's output.","Re-run 'Get fields' in the dialog after any upstream changes and re-save."],"exampleFix":"// before\nmeta.setFieldName(new String[]{\"oldField\"}); // renamed upstream\n// after\nmeta.setFieldName(new String[]{\"newField\"}); // matches actual stream field","handlingStrategy":"validation","validationCode":"for (String f : meta.getFieldName()) {\n  if (previousRowMeta.indexOfValue(f) < 0) {\n    throw new IllegalStateException(\"Field not in stream: \" + f);\n  }\n}","typeGuard":null,"tryCatchPattern":"try { trans.execute(...); } catch (KettleException e) { if (e.getMessage().contains(\"CanNotFindField\")) { log.error(\"reconfigure FieldsChangeSequence fields\"); } }","preventionTips":["Re-select fields after upstream renames","Validate field lists in tests before production runs","Keep upstream field names stable"],"tags":["field-not-found","configuration","kettle"],"backgroundTag":"record-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"}