{"record":{"id":"ba092dc095d9d0c6","repo":"pentaho/pentaho-kettle","slug":"loadfileinput-exception-couldnotfindfield","errorCode":"LoadFileInput.Exception.CouldnotFindField","errorMessage":"LoadFileInput.Exception.CouldnotFindField","messagePattern":"LoadFileInput\\.Exception\\.CouldnotFindField","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/loadfileinput/LoadFileInput.java","lineNumber":110,"sourceCode":"          // Create convert meta-data objects that will contain Date & Number formatters\n          // All non binary content is handled as a String. It would be converted to the target type after the processing.\n          data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING );\n\n          if ( meta.getFileInFields() ) {\n            // Check is filename field is provided\n            if ( Utils.isEmpty( meta.getDynamicFilenameField() ) ) {\n              logError( BaseMessages.getString( PKG, \"LoadFileInput.Log.NoField\" ) );\n              throw new KettleException( BaseMessages.getString( PKG, \"LoadFileInput.Log.NoField\" ) );\n            }\n\n            // cache the position of the field\n            if ( data.indexOfFilenameField < 0 ) {\n              data.indexOfFilenameField = data.inputRowMeta.indexOfValue( meta.getDynamicFilenameField() );\n              if ( data.indexOfFilenameField < 0 ) {\n                // The field is unreachable !\n                logError( BaseMessages.getString( PKG, \"LoadFileInput.Log.ErrorFindingField\" )\n                  + \"[\" + meta.getDynamicFilenameField() + \"]\" );\n                throw new KettleException( BaseMessages.getString(\n                  PKG, \"LoadFileInput.Exception.CouldnotFindField\", meta.getDynamicFilenameField() ) );\n              }\n            }\n            // Get the number of previous fields\n            data.totalpreviousfields = data.inputRowMeta.size();\n\n          }\n        } // end if first\n\n        // get field value\n        String fieldvalue = data.inputRowMeta.getString( data.readrow, data.indexOfFilenameField );\n\n        if ( isDetailed() ) {\n          logDetailed( BaseMessages.getString(\n            PKG, \"LoadFileInput.Log.Stream\", meta.getDynamicFilenameField(), fieldvalue ) );\n        }\n\n        try {","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/loadfileinput/LoadFileInput.java#L92-L128","documentation":"LoadFileInput.openNextFile throws this when the configured dynamic filename field is not present in the incoming row metadata (indexOfValue returns -1). The field name in the step configuration doesn't match any field produced by the previous step.","triggerScenarios":"meta.getDynamicFilenameField() is set but data.inputRowMeta.indexOfValue(field) < 0 when the first row arrives and openNextFile caches the field index.","commonSituations":"Field renamed upstream; case-sensitivity mismatch; wrong input hop; transformation edited so the field is no longer emitted.","solutions":["Preview the previous step and confirm the exact field name (case-sensitive).","Update the 'filename field' in Load File Input to match.","Re-run 'Get Fields' on the upstream step and reselect.","Verify the correct step feeds Load File Input."],"exampleFix":"// before\n// dynamicFilenameField = \"file\"\n// upstream field: \"file\"\n// after: upstream emits \"file_path\" ->\n// dynamicFilenameField = \"file_path\"","handlingStrategy":"validation","validationCode":"RowMetaInterface in = transMeta.getPrevStepFields(lfStep);\nif (in.indexOfValue(meta.getDynamicFilenameField()) < 0) {\n  throw new IllegalStateException(\"Filename field missing upstream: \" + meta.getDynamicFilenameField());\n}","typeGuard":null,"tryCatchPattern":"try {\n  trans.execute(null);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"CouldnotFindField\")) {\n    log.error(\"Filename field not found in input rows; re-check upstream fields\");\n  }\n}","preventionTips":["Case-sensitively match field names","Preview upstream fields after any upstream edit","Wire the intended input hop before configuring the step"],"tags":["kettle","pentaho","configuration","field-not-found","load-file"],"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"}