pentaho/pentaho-kettle · error · KettleException
PGPEncryptStream.Error.KeyNameMissing
Error message
PGPEncryptStream.Error.KeyNameMissing
What it means
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.
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
Example fix
// before
export RUN without PGP_KEY set; step uses ${PGP_KEY}
// after
export PGP_KEY="user@example.com" Defensive patterns
Strategy: validation
Validate before calling
String keyName = meta.getKeyName();
keyName = (keyName == null) ? null : transMeta.environmentSubstitute(keyName).trim();
if (!meta.isKeynameInField() && (keyName == null || keyName.isEmpty())) {
throw new IllegalStateException("PGP step: static key name (or its variable) is not set");
} Try / catch
try { trans.execute(null); }
catch (KettleException e) {
if (e.getMessage().contains("KeyNameMissing")) {
log.error("PGP key name empty — set it or define the referenced variable", e);
} else { throw e; }
} Prevention
- 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
When it happens
Trigger: meta.isKeynameInField() is false and environmentSubstitute(meta.getKeyName()) yields null/empty on the first row.
Common situations: 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.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- PGPEncryptStream.Error.DataStreamFieldMissing
- PGPEncryptStream.Error.KeyNameFieldMissing
- CsvInput.Exception.FilenameFieldNotFound (with…
- DimensionLookup.Exception.KeyFieldNotFound
- DimensionLookup.Exception.StartDateValueColumnNotFound
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/31e4f7578571709a.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/pgpencryptstream/PGPEncryptStream.java:95
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() ) );
}
}
} // End If first
// allocate output row
Object[] outputRow = RowDataUtil.allocateRowData( data.outputRowMeta.size() );
for ( int i = 0; i < data.NrPrevFields; i++ ) {
outputRow[i] = r[i];View on GitHub (pinned to f3058517a1)