{"record":{"id":"d4e78275c7dc08be","repo":"pentaho/pentaho-kettle","slug":"pgpencryptstream-exception-couldnotfindfield","errorCode":null,"errorMessage":"PGPEncryptStream.Exception.CouldnotFindField","messagePattern":"PGPEncryptStream\\.Exception\\.CouldnotFindField","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/pgpencryptstream/PGPEncryptStream.java","lineNumber":87,"sourceCode":"        data.outputRowMeta = data.previousRowMeta;\n        meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n          metaStore );\n\n        // Check is stream data field is provided\n        if ( Utils.isEmpty( meta.getStreamField() ) ) {\n          throw new KettleException( BaseMessages.getString( PKG, \"PGPEncryptStream.Error.DataStreamFieldMissing\" ) );\n        }\n\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() ) );","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/pgpencryptstream/PGPEncryptStream.java#L69-L105","documentation":"PGPEncryptStream.processRow throws KettleException when the configured key-name field does not exist in the incoming row metadata (indexOfValue returns -1). The message reports the field that could not be found.","triggerScenarios":"On first row: meta.isKeynameInField() is true, key field name is set, but data.previousRowMeta.indexOfValue(keyField) < 0 — the column is absent from the input stream.","commonSituations":"Upstream step renamed or removed the field, field type/alias mismatch after modifying the transformation, transformation re-wired so the PGP step no longer receives that column.","solutions":["Ensure the upstream step actually produces the key-name field and that its name matches exactly (case-sensitive)","Use 'Get Fields' in the step dialog to re-pick the field from current row metadata","Insert a 'Select values' / 'Field exists' check upstream to guarantee the column","Run the transformation with row metadata logging to inspect actual incoming fields"],"exampleFix":"// before: upstream renamed field\nString keyField = \"keyname\"; // row now has 'keyName'\n// after\nString keyField = \"keyName\"; // matches upstream field","handlingStrategy":"validation","validationCode":"// Verify the key field exists in the incoming row metadata before the PGP step\nRowMetaInterface rmi = transMeta.getPrevStepFields(prevStepName, monitor);\nif (rmi.indexOfValue(meta.getKeynameFieldName()) < 0) {\n  throw new IllegalStateException(\"Key field \" + meta.getKeynameFieldName() + \" not in input rows\");\n}","typeGuard":null,"tryCatchPattern":"try { trans.execute(null); }\ncatch (KettleException e) {\n  if (e.getMessage().contains(\"CouldnotFindField\")) {\n    log.error(\"Key field missing from input rows — check upstream step output\", e);\n  } else { throw e; }\n}","preventionTips":["Re-run 'Get Fields' after changing upstream steps","Check hop wiring after refactoring transformations","Use case-sensitive exact field names","Add a Field-exists check step in critical flows"],"tags":["kettle","pgp","row-metadata","field-not-found"],"backgroundTag":"record-not-found","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"}