{"record":{"id":"2210549365ce8038","repo":"pentaho/pentaho-kettle","slug":"pgpencryptstream-error-datatoencryptempty","errorCode":null,"errorMessage":"PGPEncryptStream.Error.DataToEncryptEmpty","messagePattern":"PGPEncryptStream\\.Error\\.DataToEncryptEmpty","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/pgpencryptstream/PGPEncryptStream.java","lineNumber":130,"sourceCode":"      for ( int i = 0; i < data.NrPrevFields; i++ ) {\n        outputRow[i] = r[i];\n      }\n\n      // get keyname if needed\n      if ( meta.isKeynameInField() ) {\n        // get keyname\n        data.keyName = data.previousRowMeta.getString( r, data.indexOfKeyName );\n        if ( Utils.isEmpty( data.keyName ) ) {\n          throw new KettleException( BaseMessages.getString( PKG, \"PGPEncryptStream.Error.KeyNameMissing\" ) );\n        }\n      }\n\n      // get stream, data to encrypt\n      String dataToEncrypt = data.previousRowMeta.getString( r, data.indexOfField );\n\n      if ( Utils.isEmpty( dataToEncrypt ) ) {\n        // no data..we can not continue with this row\n        throw new KettleException( BaseMessages.getString( PKG, \"PGPEncryptStream.Error.DataToEncryptEmpty\" ) );\n      }\n\n      // let's encrypt data\n      String encryptedData = data.gpg.encrypt( dataToEncrypt, data.keyName );\n\n      // Add encrypted data to input stream\n      outputRow[data.NrPrevFields] = encryptedData;\n\n      // add new values to the row.\n      putRow( data.outputRowMeta, outputRow ); // copy row to output rowset(s);\n\n      if ( log.isRowLevel() ) {\n        logRowlevel( BaseMessages.getString( PKG, \"PGPEncryptStream.LineNumber\", getLinesRead()\n          + \" : \" + getInputRowMeta().getString( r ) ) );\n      }\n    } catch ( Exception e ) {\n      if ( getStepMeta().isDoingErrorHandling() ) {\n        sendToErrorRow = true;","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/pgpencryptstream/PGPEncryptStream.java#L112-L148","documentation":"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.","triggerScenarios":"Per-row: data.previousRowMeta.getString(r, data.indexOfField) returns null/empty and Utils.isEmpty(dataToEncrypt) is true.","commonSituations":"Source rows with blank payload columns, upstream transformation steps that null out the field, ETL feeds with incomplete records.","solutions":["Prevent null/empty payloads upstream (default values, coalesce in SQL, Replace in field)","Filter out empty-payload rows before the PGP step","If empty values are legitimate, route them around the step or substitute a placeholder before encrypting","Add a 'Filter rows' condition: stream field IS NOT NULL AND <> ''"],"exampleFix":"// before\nrows with empty payload reach PGP step and fail\n// after\n'Filter rows' step: payload IS NOT NULL AND payload != '' -> PGP step; else -> log/audit stream","handlingStrategy":"validation","validationCode":"// 'Filter rows' before the PGP step:\n// condition: payload IS NOT NULL AND payload != ''\n// or in SQL upstream:\n// SELECT COALESCE(payload, '') AS payload, ... FROM src WHERE payload IS NOT NULL AND payload <> ''","typeGuard":null,"tryCatchPattern":"try { trans.execute(null); }\ncatch (KettleException e) {\n  if (e.getMessage().contains(\"DataToEncryptEmpty\")) {\n    log.error(\"Row had empty data to encrypt — filter/default upstream\", e);\n  } else { throw e; }\n}","preventionTips":["Filter empty payload rows before encryption","Apply defaults in the source query (COALESCE/NVL)","Route empty-value rows to an audit stream instead of failing the run","Add data-quality checks on the payload column upstream"],"tags":["kettle","pgp","data-quality","empty-value"],"backgroundTag":"empty-required-field","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}