{"record":{"id":"6a585d0da82d0820","repo":"pentaho/pentaho-kettle","slug":"databasejoin-exception-fieldnotfound-with-parameter-field","errorCode":null,"errorMessage":"DatabaseJoin.Exception.FieldNotFound (with parameter field name)","messagePattern":"DatabaseJoin\\.Exception\\.FieldNotFound \\(with parameter field name\\)","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/databasejoin/DatabaseJoin.java","lineNumber":71,"sourceCode":"        first = false;\n        prepareSQL( meta, data );\n        data.outputRowMeta = rowMeta.clone();\n        meta.getFields( getTransMeta().getBowl(),\n            data.outputRowMeta, getStepname(), new RowMetaInterface[] { meta.getTableFields(), }, null, this,\n            repository, metaStore );\n\n        data.lookupRowMeta = new RowMeta();\n\n        if ( log.isDetailed() ) {\n          logDetailed( BaseMessages.getString( PKG, \"DatabaseJoin.Log.CheckingRow\" ) + rowMeta.getString( rowData ) );\n        }\n\n        data.keynrs = new int[meta.getParameterField().length];\n\n        for ( int i = 0; i < meta.getParameterField().length; i++ ) {\n          data.keynrs[i] = rowMeta.indexOfValue( meta.getParameterField()[i] );\n          if ( data.keynrs[i] < 0 ) {\n            throw new KettleStepException( BaseMessages.getString( PKG, \"DatabaseJoin.Exception.FieldNotFound\", meta\n                .getParameterField()[i] ) );\n          }\n\n          data.lookupRowMeta.addValueMeta( rowMeta.getValueMeta( data.keynrs[i] ).clone() );\n        }\n      }\n\n      // Construct the parameters row...\n      Object[] lookupRowData = new Object[data.lookupRowMeta.size()];\n      for ( int i = 0; i < data.keynrs.length; i++ ) {\n        lookupRowData[i] = rowData[data.keynrs[i]];\n      }\n\n      // Set the values on the prepared statement (for faster exec.)\n      rs = data.db.openQuery( data.pstmt, data.lookupRowMeta, lookupRowData );\n\n      // Get a row from the database...\n      //","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/databasejoin/DatabaseJoin.java#L53-L89","documentation":"DatabaseJoin.lookupValues resolves each configured parameter field's index in the incoming row; if a parameter field name is not present in the row, it throws KettleStepException 'DatabaseJoin.Exception.FieldNotFound' with the field name. The SQL cannot be parameterized without all parameter values present, so the row is rejected and the step fails.","triggerScenarios":"processRow -> lookupValues when meta.getParameterField()[i] does not match any column of the input row (rowMeta.indexOfValue returns -1): field renamed upstream, deleted, or a typo in the 'Insert field' parameter list.","commonSituations":"Upstream step changed/renamed its output fields; connector hop wired from the wrong stream; case-sensitive field name mismatch; copy/paste of a transformation where an alias was lost.","solutions":["Open the Database Join dialog and correct the parameter field names to match the actual incoming fields exactly.","Inspect the incoming row layout (preview upstream step) and add/restore the missing field.","Add a 'Select values' step upstream to add/alias the expected field name.","Verify the hop connects the intended source step."],"exampleFix":"// before: parameter field 'cust_id' but upstream outputs 'customer_id'\nmeta.setParameterField(new String[] { \"cust_id\" });\n// after: match the real upstream field name\nmeta.setParameterField(new String[] { \"customer_id\" });","handlingStrategy":"validation","validationCode":"RowMetaInterface incoming = ...; // preview upstream row\nfor (String param : meta.getParameterField()) {\n  if (incoming.indexOfValue(param) < 0)\n    throw new IllegalArgumentException(\"Parameter field missing from stream: \" + param);\n}","typeGuard":null,"tryCatchPattern":"try { step.processRow(); }\ncatch (KettleStepException e) {\n  if (e.getMessage().contains(\"FieldNotFound\")) {\n    String field = extractQuoted(e.getMessage()); // reconfigure parameter fields\n  }\n}","preventionTips":["Verify parameter field names against an upstream preview before running","Use Select values to alias fields rather than relying on upstream names","Re-check step config after any upstream field rename"],"tags":["kettle","database-join","field-lookup"],"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"}