pentaho/pentaho-kettle · error · KettleException

PGPEncryptStream.Error.DataToEncryptEmpty

Error message

PGPEncryptStream.Error.DataToEncryptEmpty

What it means

PGPEncryptStream.processRow throws KettleException when the value of the stream field in the current row is empty or null, so there is nothing to encrypt. The step treats this as fatal for the row rather than passing it through.

Solutions

  1. Prevent null/empty payloads upstream (default values, coalesce in SQL, Replace in field)
  2. Filter out empty-payload rows before the PGP step
  3. If empty values are legitimate, route them around the step or substitute a placeholder before encrypting
  4. Add a 'Filter rows' condition: stream field IS NOT NULL AND <> ''

Example fix

// before
rows with empty payload reach PGP step and fail
// after
'Filter rows' step: payload IS NOT NULL AND payload != '' -> PGP step; else -> log/audit stream
Defensive patterns

Strategy: validation

Validate before calling

// 'Filter rows' before the PGP step:
// condition: payload IS NOT NULL AND payload != ''
// or in SQL upstream:
// SELECT COALESCE(payload, '') AS payload, ... FROM src WHERE payload IS NOT NULL AND payload <> ''

Try / catch

try { trans.execute(null); }
catch (KettleException e) {
  if (e.getMessage().contains("DataToEncryptEmpty")) {
    log.error("Row had empty data to encrypt — filter/default upstream", e);
  } else { throw e; }
}

Prevention

When it happens

Trigger: Per-row: data.previousRowMeta.getString(r, data.indexOfField) returns null/empty and Utils.isEmpty(dataToEncrypt) is true.

Common situations: Source rows with blank payload columns, upstream transformation steps that null out the field, ETL feeds with incomplete records.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

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

      for ( int i = 0; i < data.NrPrevFields; i++ ) {
        outputRow[i] = r[i];
      }

      // get keyname if needed
      if ( meta.isKeynameInField() ) {
        // get keyname
        data.keyName = data.previousRowMeta.getString( r, data.indexOfKeyName );
        if ( Utils.isEmpty( data.keyName ) ) {
          throw new KettleException( BaseMessages.getString( PKG, "PGPEncryptStream.Error.KeyNameMissing" ) );
        }
      }

      // get stream, data to encrypt
      String dataToEncrypt = data.previousRowMeta.getString( r, data.indexOfField );

      if ( Utils.isEmpty( dataToEncrypt ) ) {
        // no data..we can not continue with this row
        throw new KettleException( BaseMessages.getString( PKG, "PGPEncryptStream.Error.DataToEncryptEmpty" ) );
      }

      // let's encrypt data
      String encryptedData = data.gpg.encrypt( dataToEncrypt, data.keyName );

      // Add encrypted data to input stream
      outputRow[data.NrPrevFields] = encryptedData;

      // add new values to the row.
      putRow( data.outputRowMeta, outputRow ); // copy row to output rowset(s);

      if ( log.isRowLevel() ) {
        logRowlevel( BaseMessages.getString( PKG, "PGPEncryptStream.LineNumber", getLinesRead()
          + " : " + getInputRowMeta().getString( r ) ) );
      }
    } catch ( Exception e ) {
      if ( getStepMeta().isDoingErrorHandling() ) {
        sendToErrorRow = true;

View on GitHub (pinned to f3058517a1)