{"record":{"id":"a063a9a2454b8a54","repo":"pentaho/pentaho-kettle","slug":"unable-to-find-key-field-keystreamfieldname-in-the-input","errorCode":null,"errorMessage":"Unable to find key field '\" + keyStreamFieldName + \"' in the input fields","messagePattern":"Unable to find key field '\" \\+ keyStreamFieldName \\+ \"' in the input fields","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/lucid-db-streaming-loader/core/src/main/java/org/pentaho/di/trans/steps/luciddbstreamingloader/LucidDBStreamingLoaderMeta.java","lineNumber":440,"sourceCode":"    boolean suppress_comma = true;\n\n    StringBuffer sb = new StringBuffer( 300 );\n    // Iterate over fieldStreamForKeys[]\n\n    for ( int i = 0; i < fieldStreamForKeys.length; i++ ) {\n\n      // Add comma to all except the first row\n      if ( suppress_comma == true ) {\n        suppress_comma = false;\n      } else {\n        sb.append( \",\" );\n      }\n\n      String keyStreamFieldName = fieldStreamForKeys[i];\n      ValueMetaInterface keyStreamField = prev.searchValueMeta( fieldStreamForKeys[i] );\n\n      if ( keyStreamField == null ) {\n        throw new KettleStepException( \"Unable to find key field '\" + keyStreamFieldName + \"' in the input fields\" );\n      }\n\n      sb.append( buildFakeCursorRowString( keyStreamField, keyStreamFieldName ) ).append( Const.CR );\n\n    }\n\n    // Iterate over fieldStreamForFields[] (dedup)\n    for ( int i = 0; i < fieldStreamForFields.length; i++ ) {\n      // Do not add if it's already in from keys\n      if ( !isInKeys( fieldStreamForFields[i] ) ) {\n        // Add comma to all except the first row\n        if ( suppress_comma == true ) {\n          suppress_comma = false;\n        } else {\n          sb.append( \",\" );\n        }\n\n        sb.append( buildFakeCursorRowString(","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/lucid-db-streaming-loader/core/src/main/java/org/pentaho/di/trans/steps/luciddbstreamingloader/LucidDBStreamingLoaderMeta.java#L422-L458","documentation":"buildRemoteRowsCursorFromInputInMeta builds the fake cursor row string for the key fields of the LucidDB streaming load. Before appending a key field it looks the field up in the step's input row metadata (prev.searchValueMeta); if a configured key stream field does not exist in the incoming row layout, a KettleStepException with this message is thrown.","triggerScenarios":"Calling getFields()/step metadata validation when fieldStreamForKeys[i] names a column that is not present in the output of the preceding step (prev.searchValueMeta returns null).","commonSituations":"Renaming or removing the key column in the upstream step after configuring the loader; a typo in the key field name in the dialog; upstream step changed its output schema (different table/source).","solutions":["Open the LucidDB Streaming Loader dialog and correct the 'key field' names to match the actual upstream output columns.","Run 'Get Fields' in the step dialog to re-populate the key field list from the real input row metadata.","Fix the upstream step so it again produces the expected key column (restore a renamed/removed field).","Re-order steps so the loader's input actually contains the key fields."],"exampleFix":"// before (dialog XML)\n<field_stream_for_keys>custId_old</field_stream_for_keys>\n// after\n<field_stream_for_keys>customer_id</field_stream_for_keys>","handlingStrategy":"validation","validationCode":"RowMetaInterface prev = transMeta.getPrevStepFields(stepMeta);\nfor (String key : meta.getFieldStreamForKeys()) {\n  if (prev != null && prev.searchValueMeta(key) == null) {\n    throw new KettleStepException(\"Key field '\" + key + \"' missing from upstream output\");\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  meta.getFields(row, name, info, stepMeta, transMeta, metaStore);\n} catch (KettleStepException e) {\n  logError(e.getMessage()); // 'Unable to find key field ...'\n  throw e;\n}","preventionTips":["Use 'Get Fields' in the dialog instead of typing key field names by hand.","Re-validate the step after changing any upstream step's output schema.","Avoid renaming upstream columns without updating downstream loaders.","Add explicit rename/rename steps when upstream schema changes."],"tags":["kettle","field-mapping","validation","schema"],"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"}