pentaho/pentaho-kettle · error · KettleException

PGPEncryptStream.Exception.CouldnotFindField

Error message

PGPEncryptStream.Exception.CouldnotFindField

What it means

PGPEncryptStream.processRow throws KettleException when the configured key-name field does not exist in the incoming row metadata (indexOfValue returns -1). The message reports the field that could not be found.

Solutions

  1. Ensure the upstream step actually produces the key-name field and that its name matches exactly (case-sensitive)
  2. Use 'Get Fields' in the step dialog to re-pick the field from current row metadata
  3. Insert a 'Select values' / 'Field exists' check upstream to guarantee the column
  4. Run the transformation with row metadata logging to inspect actual incoming fields

Example fix

// before: upstream renamed field
String keyField = "keyname"; // row now has 'keyName'
// after
String keyField = "keyName"; // matches upstream field
Defensive patterns

Strategy: validation

Validate before calling

// Verify the key field exists in the incoming row metadata before the PGP step
RowMetaInterface rmi = transMeta.getPrevStepFields(prevStepName, monitor);
if (rmi.indexOfValue(meta.getKeynameFieldName()) < 0) {
  throw new IllegalStateException("Key field " + meta.getKeynameFieldName() + " not in input rows");
}

Try / catch

try { trans.execute(null); }
catch (KettleException e) {
  if (e.getMessage().contains("CouldnotFindField")) {
    log.error("Key field missing from input rows — check upstream step output", e);
  } else { throw e; }
}

Prevention

When it happens

Trigger: On first row: meta.isKeynameInField() is true, key field name is set, but data.previousRowMeta.indexOfValue(keyField) < 0 — the column is absent from the input stream.

Common situations: Upstream step renamed or removed the field, field type/alias mismatch after modifying the transformation, transformation re-wired so the PGP step no longer receives that column.

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/d4e78275c7dc08be. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/pgpencryptstream/PGPEncryptStream.java:87

        data.outputRowMeta = data.previousRowMeta;
        meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,
          metaStore );

        // Check is stream data field is provided
        if ( Utils.isEmpty( meta.getStreamField() ) ) {
          throw new KettleException( BaseMessages.getString( PKG, "PGPEncryptStream.Error.DataStreamFieldMissing" ) );
        }

        if ( meta.isKeynameInField() ) {
          // keyname will be extracted from a field
          String keyField = meta.getKeynameFieldName();
          if ( Utils.isEmpty( keyField ) ) {
            throw new KettleException( BaseMessages.getString( PKG, "PGPEncryptStream.Error.KeyNameFieldMissing" ) );
          }
          data.indexOfKeyName = data.previousRowMeta.indexOfValue( keyField );
          if ( data.indexOfKeyName < 0 ) {
            // The field is unreachable !
            throw new KettleException( BaseMessages.getString(
              PKG, "PGPEncryptStream.Exception.CouldnotFindField", meta.getStreamField() ) );
          }
        } else {
          // Check is keyname is provided
          data.keyName = environmentSubstitute( meta.getKeyName() );

          if ( Utils.isEmpty( data.keyName ) ) {
            throw new KettleException( BaseMessages.getString( PKG, "PGPEncryptStream.Error.KeyNameMissing" ) );
          }
        }

        // cache the position of the field
        if ( data.indexOfField < 0 ) {
          data.indexOfField = data.previousRowMeta.indexOfValue( meta.getStreamField() );
          if ( data.indexOfField < 0 ) {
            // The field is unreachable !
            throw new KettleException( BaseMessages.getString(
              PKG, "PGPEncryptStream.Exception.CouldnotFindField", meta.getStreamField() ) );

View on GitHub (pinned to f3058517a1)