{"record":{"id":"d8ae28a8a6ecd7af","repo":"pentaho/pentaho-kettle","slug":"ldifinput-exception-couldnotfindfield","errorCode":"LDIFInput.Exception.CouldnotFindField","errorMessage":"LDIFInput.Exception.CouldnotFindField","messagePattern":"LDIFInput\\.Exception\\.CouldnotFindField","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/ldifinput/LDIFInput.java","lineNumber":328,"sourceCode":"          data.totalpreviousfields = data.inputRowMeta.size();\n\n          // Create convert meta-data objects that will contain Date & Number formatters\n          data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING );\n\n          // Check is filename field is provided\n          if ( Utils.isEmpty( meta.getDynamicFilenameField() ) ) {\n            logError( BaseMessages.getString( PKG, \"LDIFInput.Log.NoField\" ) );\n            throw new KettleException( BaseMessages.getString( PKG, \"LDIFInput.Log.NoField\" ) );\n          }\n\n          // cache the position of the field\n          if ( data.indexOfFilenameField < 0 ) {\n            data.indexOfFilenameField = getInputRowMeta().indexOfValue( meta.getDynamicFilenameField() );\n            if ( data.indexOfFilenameField < 0 ) {\n              // The field is unreachable !\n              logError( BaseMessages.getString( PKG, \"LDIFInput.Log.ErrorFindingField\" )\n                + \"[\" + meta.getDynamicFilenameField() + \"]\" );\n              throw new KettleException( BaseMessages.getString(\n                PKG, \"LDIFInput.Exception.CouldnotFindField\", meta.getDynamicFilenameField() ) );\n            }\n          }\n\n        } // End if first\n        String filename = environmentSubstitute( getInputRowMeta().getString( data.readrow, data.indexOfFilenameField ) );\n        if ( isDetailed() ) {\n          logDetailed( BaseMessages.getString( PKG, \"LDIFInput.Log.FilenameInStream\", meta\n            .getDynamicFilenameField(), filename ) );\n        }\n\n        data.file = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( filename, getTransMeta() );\n      }\n      data.filename = KettleVFS.getFilename( data.file );\n      // Add additional fields?\n      if ( meta.getShortFileNameField() != null && meta.getShortFileNameField().length() > 0 ) {\n        data.shortFilename = data.file.getName().getBaseName();\n      }","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/ldifinput/LDIFInput.java#L310-L346","documentation":"LDIFInput.openNextFile throws this when the configured dynamic filename field cannot be found in the input row metadata (indexOfValue returns -1). The field name set in the step config does not exist among the fields arriving from the previous step.","triggerScenarios":"meta.getDynamicFilenameField() is non-empty, but getInputRowMeta().indexOfValue(field) < 0 when openNextFile processes the first row.","commonSituations":"Upstream step renamed or removed the field; case mismatch in field name; transformation edited so the field is no longer produced; wrong step wired as input.","solutions":["Verify the exact field name (case-sensitive) exists in the previous step's output via a Preview/Get Fields.","Update the LDIF Input 'filename field' setting to match the upstream field name exactly.","Re-run 'Get Fields' on the upstream step and reselect the field.","Ensure the correct hop/step feeds the LDIF Input step."],"exampleFix":"// before\n// dynamicFilenameField = \"file_name\"\n// upstream output field: \"fileName\"\n// after\n// dynamicFilenameField = \"fileName\"  (matches upstream exactly)","handlingStrategy":"validation","validationCode":"RowMetaInterface in = transMeta.getPrevStepFields(ldifStep);\nif (in.indexOfValue(meta.getDynamicFilenameField()) < 0) {\n  throw new IllegalStateException(\"Field not produced 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 in input rows; check upstream step fields\");\n  }\n}","preventionTips":["Match field names case-sensitively to upstream output","Re-run 'Get Fields' after editing upstream steps","Preview upstream rows before wiring file-input steps"],"tags":["kettle","pentaho","configuration","field-not-found","ldif"],"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"}