pentaho/pentaho-kettle · error · KettleException

LDIFInput.Exception.CouldnotFindField

LDIFInput.Exception.CouldnotFindField

Error message

LDIFInput.Exception.CouldnotFindField

What it means

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.

Solutions

  1. Verify the exact field name (case-sensitive) exists in the previous step's output via a Preview/Get Fields.
  2. Update the LDIF Input 'filename field' setting to match the upstream field name exactly.
  3. Re-run 'Get Fields' on the upstream step and reselect the field.
  4. Ensure the correct hop/step feeds the LDIF Input step.

Example fix

// before
// dynamicFilenameField = "file_name"
// upstream output field: "fileName"
// after
// dynamicFilenameField = "fileName"  (matches upstream exactly)
Defensive patterns

Strategy: validation

Validate before calling

RowMetaInterface in = transMeta.getPrevStepFields(ldifStep);
if (in.indexOfValue(meta.getDynamicFilenameField()) < 0) {
  throw new IllegalStateException("Field not produced upstream: " + meta.getDynamicFilenameField());
}

Try / catch

try {
  trans.execute(null);
} catch (KettleException e) {
  if (e.getMessage().contains("CouldnotFindField")) {
    log.error("Filename field not in input rows; check upstream step fields");
  }
}

Prevention

When it happens

Trigger: meta.getDynamicFilenameField() is non-empty, but getInputRowMeta().indexOfValue(field) < 0 when openNextFile processes the first row.

Common situations: 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.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/d8ae28a8a6ecd7af. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/ldifinput/LDIFInput.java:328

          data.totalpreviousfields = data.inputRowMeta.size();

          // Create convert meta-data objects that will contain Date & Number formatters
          data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING );

          // Check is filename field is provided
          if ( Utils.isEmpty( meta.getDynamicFilenameField() ) ) {
            logError( BaseMessages.getString( PKG, "LDIFInput.Log.NoField" ) );
            throw new KettleException( BaseMessages.getString( PKG, "LDIFInput.Log.NoField" ) );
          }

          // cache the position of the field
          if ( data.indexOfFilenameField < 0 ) {
            data.indexOfFilenameField = getInputRowMeta().indexOfValue( meta.getDynamicFilenameField() );
            if ( data.indexOfFilenameField < 0 ) {
              // The field is unreachable !
              logError( BaseMessages.getString( PKG, "LDIFInput.Log.ErrorFindingField" )
                + "[" + meta.getDynamicFilenameField() + "]" );
              throw new KettleException( BaseMessages.getString(
                PKG, "LDIFInput.Exception.CouldnotFindField", meta.getDynamicFilenameField() ) );
            }
          }

        } // End if first
        String filename = environmentSubstitute( getInputRowMeta().getString( data.readrow, data.indexOfFilenameField ) );
        if ( isDetailed() ) {
          logDetailed( BaseMessages.getString( PKG, "LDIFInput.Log.FilenameInStream", meta
            .getDynamicFilenameField(), filename ) );
        }

        data.file = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( filename, getTransMeta() );
      }
      data.filename = KettleVFS.getFilename( data.file );
      // Add additional fields?
      if ( meta.getShortFileNameField() != null && meta.getShortFileNameField().length() > 0 ) {
        data.shortFilename = data.file.getName().getBaseName();
      }

View on GitHub (pinned to f3058517a1)