pentaho/pentaho-kettle · error · KettleException

PGPEncryptStream.Error.KeyNameFieldMissing

Error message

PGPEncryptStream.Error.KeyNameFieldMissing

What it means

PGPEncryptStream.processRow throws KettleException when 'keyname will be taken from a field' is enabled but the key-name field name itself is empty. Without it the step cannot locate the column holding the PGP key name per row.

Solutions

  1. In the step dialog, select the field that contains the PGP key name
  2. If configuring in code, call meta.setKeynameFieldName("keyColumn")
  3. Or disable 'keyname from field' and supply a static key name instead

Example fix

// before
meta.setKeynameInField( true ); // keyname field not set
// after
meta.setKeynameInField( true );
meta.setKeynameFieldName( "recipient_key" );
Defensive patterns

Strategy: validation

Validate before calling

if (meta.isKeynameInField()
    && (meta.getKeynameFieldName() == null || meta.getKeynameFieldName().trim().isEmpty())) {
  throw new IllegalStateException("PGP step: keyname field must be set when keyname-in-field is enabled");
}

Try / catch

try { trans.execute(null); }
catch (KettleException e) {
  if (e.getMessage().contains("KeyNameFieldMissing")) {
    log.error("Select the key-name field in the PGP Encrypt Stream step", e);
  } else { throw e; }
}

Prevention

When it happens

Trigger: meta.isKeynameInField() is true and meta.getKeynameFieldName() returns empty, checked on the first processed row.

Common situations: User enabled 'keyname from field' but forgot to pick the field in the dialog; metadata built in code with setKeynameInField(true) but no keyname field set.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

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

      if ( first ) {
        first = false;
        // get the RowMeta
        data.previousRowMeta = getInputRowMeta().clone();
        data.NrPrevFields = data.previousRowMeta.size();
        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 ) {

View on GitHub (pinned to f3058517a1)