{"record":{"id":"31e4f7578571709a","repo":"pentaho/pentaho-kettle","slug":"pgpencryptstream-error-keynamemissing","errorCode":null,"errorMessage":"PGPEncryptStream.Error.KeyNameMissing","messagePattern":"PGPEncryptStream\\.Error\\.KeyNameMissing","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/pgpencryptstream/PGPEncryptStream.java","lineNumber":95,"sourceCode":"\n        if ( meta.isKeynameInField() ) {\n          // keyname will be extracted from a field\n          String keyField = meta.getKeynameFieldName();\n          if ( Utils.isEmpty( keyField ) ) {\n            throw new KettleException( BaseMessages.getString( PKG, \"PGPEncryptStream.Error.KeyNameFieldMissing\" ) );\n          }\n          data.indexOfKeyName = data.previousRowMeta.indexOfValue( keyField );\n          if ( data.indexOfKeyName < 0 ) {\n            // The field is unreachable !\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"PGPEncryptStream.Exception.CouldnotFindField\", meta.getStreamField() ) );\n          }\n        } else {\n          // Check is keyname is provided\n          data.keyName = environmentSubstitute( meta.getKeyName() );\n\n          if ( Utils.isEmpty( data.keyName ) ) {\n            throw new KettleException( BaseMessages.getString( PKG, \"PGPEncryptStream.Error.KeyNameMissing\" ) );\n          }\n        }\n\n        // cache the position of the field\n        if ( data.indexOfField < 0 ) {\n          data.indexOfField = data.previousRowMeta.indexOfValue( meta.getStreamField() );\n          if ( data.indexOfField < 0 ) {\n            // The field is unreachable !\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"PGPEncryptStream.Exception.CouldnotFindField\", meta.getStreamField() ) );\n          }\n        }\n      } // End If first\n\n      // allocate output row\n      Object[] outputRow = RowDataUtil.allocateRowData( data.outputRowMeta.size() );\n      for ( int i = 0; i < data.NrPrevFields; i++ ) {\n        outputRow[i] = r[i];","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/pgpencryptstream/PGPEncryptStream.java#L77-L113","documentation":"PGPEncryptStream.processRow throws KettleException when a static (non-field) key name is expected but the configured key name (after environment substitution) is empty. The step needs a PGP recipient key name to encrypt.","triggerScenarios":"meta.isKeynameInField() is false and environmentSubstitute(meta.getKeyName()) yields null/empty on the first row.","commonSituations":"Key name field left blank in the dialog, the referenced environment variable (e.g. ${PGP_KEY}) is undefined in the runtime environment, key name set only with whitespace.","solutions":["Set the key name in the step dialog (the user ID of the recipient's PGP key)","If using a variable like ${PGP_KEY_NAME}, define it in kettle.properties or the environment configuration","Check for typos/whitespace-only values in the key name"],"exampleFix":"// before\nexport RUN without PGP_KEY set; step uses ${PGP_KEY}\n// after\nexport PGP_KEY=\"user@example.com\"","handlingStrategy":"validation","validationCode":"String keyName = meta.getKeyName();\nkeyName = (keyName == null) ? null : transMeta.environmentSubstitute(keyName).trim();\nif (!meta.isKeynameInField() && (keyName == null || keyName.isEmpty())) {\n  throw new IllegalStateException(\"PGP step: static key name (or its variable) is not set\");\n}","typeGuard":null,"tryCatchPattern":"try { trans.execute(null); }\ncatch (KettleException e) {\n  if (e.getMessage().contains(\"KeyNameMissing\")) {\n    log.error(\"PGP key name empty — set it or define the referenced variable\", e);\n  } else { throw e; }\n}","preventionTips":["Define environment variables used in step config in kettle.properties per environment","Avoid whitespace-only config values","Document required variables alongside the transformation","Validate ${var} references in CI with the target environment's properties"],"tags":["kettle","pgp","step-config","environment-variable"],"backgroundTag":"missing-env-var","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"}