{"record":{"id":"ee829bf8628ab0ca","repo":"pentaho/pentaho-kettle","slug":"ifnull-log-cannotfindfield","errorCode":null,"errorMessage":"IfNull.Log.CanNotFindField","messagePattern":"IfNull\\.Log\\.CanNotFindField","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/ifnull/IfNull.java","lineNumber":91,"sourceCode":"      // For String to <type> conversions, we allocate a conversion meta data row as well...\n      //\n      data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING );\n\n      if ( meta.isSelectFields() ) {\n        // Consider only selected fields\n        if ( meta.getFields() != null && meta.getFields().length > 0 ) {\n          int fieldsLength = meta.getFields().length;\n          data.fieldnrs = new int[fieldsLength];\n          data.defaultValues = new String[fieldsLength];\n          data.defaultMasks = new String[fieldsLength];\n          data.setEmptyString = new boolean[fieldsLength];\n\n          for ( int i = 0; i < meta.getFields().length; i++ ) {\n            data.fieldnrs[i] = data.outputRowMeta.indexOfValue( meta.getFields()[i].getFieldName() );\n            if ( data.fieldnrs[i] < 0 ) {\n              logError( BaseMessages.getString( PKG, \"IfNull.Log.CanNotFindField\", meta.getFields()[i]\n                  .getFieldName() ) );\n              throw new KettleException( BaseMessages.getString( PKG, \"IfNull.Log.CanNotFindField\", meta.getFields()[i]\n                  .getFieldName() ) );\n            }\n            data.defaultValues[i] = environmentSubstitute( meta.getFields()[i].getReplaceValue() );\n            data.defaultMasks[i] = environmentSubstitute( meta.getFields()[i].getReplaceMask() );\n            data.setEmptyString[i] = meta.getFields()[i].isSetEmptyString();\n          }\n        } else {\n          throw new KettleException( BaseMessages.getString( PKG, \"IfNull.Log.SelectFieldsEmpty\" ) );\n        }\n      } else if ( meta.isSelectValuesType() ) {\n        // Consider only select value types\n        if ( meta.getValueTypes() != null && meta.getValueTypes().length > 0 ) {\n          // return the real default values\n          int typeLength = meta.getValueTypes().length;\n          data.defaultValues = new String[typeLength];\n          data.defaultMasks = new String[typeLength];\n          data.setEmptyString = new boolean[typeLength];\n","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/ifnull/IfNull.java#L73-L109","documentation":"The If Null step's processRow() resolves each configured field name to an index in the output row metadata. When a configured field name is not present in the incoming row stream, data.fieldnrs[i] is -1, an error is logged, and a KettleException with this message (containing the offending field name) is thrown, aborting the transformation.","triggerScenarios":"processRow runs and meta.getFields() contains a field name that indexOfValue() cannot find in the output row metadata — i.e., the configured 'set value if null' field does not exist in the input stream.","commonSituations":"Upstream step renamed or removed the field; field name typo in the If Null dialog; dynamic field layout from a table input where the column doesn't exist; case-sensitivity mismatch in field names.","solutions":["Open the If Null step dialog, remove/re-select the missing field, and re-save the transformation","Check the upstream step that produces the field and confirm the field actually reaches this step","Enable/inspect the preview of the previous step to see the actual row field names","Make field names case-consistent (Kettle field lookup is case-sensitive)"],"exampleFix":"// before (If Null step config referencing removed column)\nfields: [ { fieldName: \"amnt\" } ]\n// after (match actual upstream column)\nfields: [ { fieldName: \"amount\" } ]","handlingStrategy":"validation","validationCode":"for (String f : ifNullMeta.getFieldNames()) { if (prevRowMeta.indexOfValue(f) < 0) throw new IllegalStateException(\"Missing field: \" + f); }","typeGuard":"boolean fieldExists(RowMetaInterface row, String name) { return row != null && row.indexOfValue(name) >= 0; }","tryCatchPattern":"try { trans.execute(null); } catch (KettleException e) { if (e.getMessage().contains(\"CanNotFindField\")) { fixFieldMapping(); } else { throw e; } }","preventionTips":["Preview upstream rows to confirm field names before configuring the step","Use the dialog field picker instead of typing names","Keep field names case-consistent across steps"],"tags":["kettle","transformation","field-mapping"],"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"}