pentaho/pentaho-kettle · error · KettleException

LDAPInput.Exception.CouldnotFindField

LDAPInput.Exception.CouldnotFindField

Error message

LDAPInput.Exception.CouldnotFindField

What it means

dynamicSearch() throws 'CouldnotFindField' when dynamic search is on, the field name is set, but getInputRowMeta().indexOfValue(dynamicSearchFieldName) returns -1 — the configured search-base field does not exist in the incoming row. The configured name is included in the message. Unlike error 3133, configuration exists but the field is unreachable in the actual row stream.

Solutions

  1. Compare the field name in the LDAP Input dialog against actual hop fields (right-click hop → 'Show fields').
  2. Fix case/spelling mismatches between the configured name and the upstream field.
  3. Insert/repair the upstream step that generates the DN field (e.g. a 'Get values' or previous input step).

Example fix

// before
meta.setDynamicSearchFieldName("Distinguished Name");
// after (matches actual upstream field)
meta.setDynamicSearchFieldName("dn");
Defensive patterns

Strategy: validation

Validate before calling

int idx = inputRowMeta.indexOfValue(meta.getDynamicSearchFieldName());
if (idx < 0) throw new IllegalStateException("Field " + meta.getDynamicSearchFieldName() + " not found on incoming rows");

Try / catch

try { row = getOneRow(); } catch (KettleException e) { if (e.getMessage().contains("CouldnotFindField")) { logError("Configured field no longer exists upstream: " + e.getMessage()); } throw e; }

Prevention

When it happens

Trigger: Run with isDynamicSearch()==true and indexOfSearchBaseField < 0 because the field name in metadata doesn't match any field arriving at the step.

Common situations: Upstream step renamed/removed the DN field, field name differs in case or has trailing spaces, or the LDAP Input step sits directly after an input step that never produced that field.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at plugins/ldap/impl/src/main/java/org/pentaho/di/trans/steps/ldapinput/LDAPInput.java:164

          throw new KettleException( BaseMessages.getString( PKG, "LDAPInput.Error.DynamicFilterFieldMissing" ) );
        }
      }

      // Create the output row meta-data
      data.nrIncomingFields = getInputRowMeta().size();
      data.outputRowMeta = getInputRowMeta().clone();
      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,
                      metaStore );

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

      if ( meta.isDynamicSearch() ) {
        data.indexOfSearchBaseField = getInputRowMeta().indexOfValue( meta.getDynamicSearchFieldName() );
        if ( data.indexOfSearchBaseField < 0 ) {
          // The field is unreachable !
          throw new KettleException( BaseMessages.getString( PKG, "LDAPInput.Exception.CouldnotFindField", meta
            .getDynamicSearchFieldName() ) );
        }
      }
      if ( meta.isDynamicFilter() ) {
        data.indexOfFilterField = getInputRowMeta().indexOfValue( meta.getDynamicFilterFieldName() );
        if ( data.indexOfFilterField < 0 ) {
          // The field is unreachable !
          throw new KettleException( BaseMessages.getString( PKG, "LDAPInput.Exception.CouldnotFindField", meta
            .getDynamicFilterFieldName() ) );
        }
      }
    } // end if

    String searchBase = data.staticSearchBase;
    if ( data.indexOfSearchBaseField > 0 ) {
      // retrieve dynamic search base value
      searchBase = getInputRowMeta().getString( data.readRow, data.indexOfSearchBaseField );
    }

View on GitHub (pinned to f3058517a1)