{"record":{"id":"c5bb78e166b33155","repo":"pentaho/pentaho-kettle","slug":"can-not-find-field-0-in-the-input-stream","errorCode":null,"errorMessage":"Can not find field [{0}] in the input stream!","messagePattern":"Can not find field \\[(.+?)\\] in the input stream!","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/setvalueconstant/SetValueConstant.java","lineNumber":96,"sourceCode":"      int size = fields.size();\n      if ( !Utils.isEmpty( fields ) ) {\n        data.setFieldnrs( new int[size] );\n        data.setRealReplaceByValues( new String[size] );\n        for ( int i = 0; i < size; i++ ) {\n          // Check if this field was specified only one time\n          final SetValueConstantMeta.Field check = fields.get( i );\n          for ( SetValueConstantMeta.Field field : fields ) {\n            if ( field.getFieldName() != null && field != check && field.getFieldName().equalsIgnoreCase( check.getFieldName() ) ) {\n              throw new KettleException( BaseMessages.getString( PKG, \"SetValueConstant.Log\"\n                      + \".FieldSpecifiedMoreThatOne\", check.getFieldName() ) );\n            }\n          }\n\n          data.getFieldnrs()[i] = data.getOutputRowMeta().indexOfValue( meta.getField( i ).getFieldName() );\n\n          if ( data.getFieldnrs()[i] < 0 ) {\n            logError( BaseMessages.getString( PKG, \"SetValueConstant.Log.CanNotFindField\", meta.getField( i ).getFieldName() ) );\n            throw new KettleException( BaseMessages.getString( PKG, \"SetValueConstant.Log.CanNotFindField\", meta\n              .getField( i ).getFieldName() ) );\n          }\n\n          if ( meta.getField( i ).isEmptyString() ) {\n            // Just set empty string\n            data.getRealReplaceByValues()[i] = StringUtil.EMPTY_STRING;\n          } else {\n            // set specified value\n            if ( meta.isUseVars() ) {\n              data.getRealReplaceByValues()[i] = environmentSubstitute( meta.getField( i ).getReplaceValue() );\n            } else {\n              data.getRealReplaceByValues()[i] = meta.getField( i ).getReplaceValue();\n            }\n          }\n        }\n      } else {\n        throw new KettleException( BaseMessages.getString( PKG, \"SetValueConstant.Log.SelectFieldsEmpty\" ) );\n      }","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/setvalueconstant/SetValueConstant.java#L78-L114","documentation":"SetValueConstant.processRow() throws KettleException 'SetValueConstant.Log.CanNotFindField' when indexOfValue() returns -1 for a configured field name, i.e. the field is absent from the step's input row stream. The step cannot replace a value in a field that does not exist.","triggerScenarios":"First row processing when data.getFieldnrs()[i] < 0 for the field named in the Fields tab — the field was renamed/removed upstream or the name contains typos/extra whitespace.","commonSituations":"Upstream step schema changed (renamed or dropped column); field name entered with wrong case/spaces; transformation run against a different input source than when designed.","solutions":["Add the missing field upstream or correct the field name in the step's Fields grid","Refresh upstream step field lists and re-enter the name exactly","Enable variable substitution check: if 'use variable' is set, ensure the variable resolves to a real field name","Re-run after verifying with 'View input fields' on the step"],"exampleFix":"// before: Fields tab has name='custmomer_id'\n// after\n// Fields tab name corrected to 'customer_id'","handlingStrategy":"validation","validationCode":"for (SetValueConstantMeta.Field f : meta.getField()) {\n  if (inputRowMeta.indexOfValue(f.getFieldName()) < 0)\n    throw new IllegalStateException(\"Input stream missing field: \" + f.getFieldName());\n}","typeGuard":"boolean fieldPresent(RowMetaInterface row, String name) { return row != null && name != null && row.indexOfValue(name) >= 0; }","tryCatchPattern":"try { step.processRow(); } catch (KettleException e) { if (e.getMessage().startsWith(\"Can not find field\")) { /* fix field names upstream */ } else throw e; }","preventionTips":["Verify upstream step field lists after any schema change","Check for typos, spaces, and case mismatches in field names","Pin variable-substituted names and test their resolution","Use the step's field-preview before production runs"],"tags":["kettle","missing-field","row-metadata"],"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"}