{"record":{"id":"10f150b528d66823","repo":"pentaho/pentaho-kettle","slug":"execsql-exception-couldnotfindfield","errorCode":"ExecSQL.Exception.CouldNotFindField","errorMessage":"ExecSQL.Exception.CouldNotFindField","messagePattern":"ExecSQL\\.Exception\\.CouldNotFindField","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/sql/ExecSQL.java","lineNumber":121,"sourceCode":"      setOutputDone();\n      return false;\n    }\n\n    if ( first ) { // we just got started\n\n      first = false;\n\n      data.outputRowMeta = getInputRowMeta().clone();\n      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n        metaStore );\n\n      // Find the indexes of the arguments\n      data.argumentIndexes = new int[meta.getArguments().length];\n      for ( int i = 0; i < meta.getArguments().length; i++ ) {\n        data.argumentIndexes[i] = this.getInputRowMeta().indexOfValue( meta.getArguments()[i] );\n        if ( data.argumentIndexes[i] < 0 ) {\n          logError( BaseMessages.getString( PKG, \"ExecSQL.Log.ErrorFindingField\" ) + meta.getArguments()[i] + \"]\" );\n          throw new KettleStepException( BaseMessages.getString( PKG, \"ExecSQL.Exception.CouldNotFindField\", meta\n            .getArguments()[i] ) );\n        }\n        if ( meta.isParams() ) {\n          if ( i == 0 ) {\n            // Define parameters meta\n            data.paramsMeta = new RowMeta();\n          }\n          data.paramsMeta.addValueMeta( getInputRowMeta().getValueMeta( data.argumentIndexes[i] ) );\n        }\n      }\n\n      if ( !meta.isParams() ) {\n        // We need to replace question marks by string value\n\n        // Find the locations of the question marks in the String...\n        // We replace the question marks with the values...\n        // We ignore quotes etc. to make inserts easier...\n        data.markerPositions = new ArrayList<Integer>();","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/sql/ExecSQL.java#L103-L139","documentation":"Thrown by ExecSQL.processRow when one of the configured argument field names cannot be found in the incoming row stream. indexOfValue returns -1 for each missing field, which triggers this KettleStepException with the field name from the message bundle. The ExecSQL step needs all argument fields present in the input rows to bind SQL parameters.","triggerScenarios":"Running a transformation where the ExecSQL step's 'insert field' / arguments list references a field absent from the input row meta — e.g. an upstream step was renamed, removed, or its output field name changed after the ExecSQL step was configured.","commonSituations":"Renaming a field in a Select values or Text file input step upstream; deleting a Calculator step that produced the argument field; case-sensitive field name mismatch; streaming data from a changed external schema.","solutions":["Open the ExecSQL step and re-map the arguments to existing fields from the incoming stream","Check upstream steps to confirm the field is produced with the exact name (case included)","Add/repair the upstream step that generates the missing field","Preview the input rows to see the actual field names before the ExecSQL step"],"exampleFix":"// before (step config)\narguments = new String[] { \"custID\" };   // input has \"custId\"\n// after\narguments = new String[] { \"custId\" };   // match exact input field name","handlingStrategy":"validation","validationCode":"String[] args = execSqlMeta.getArguments();\nRowMetaInterface input = trans.getTransMeta().getPrevStepFields(execSqlStepName);\nfor (String a : args) {\n  if (a != null && input.indexOfValue(a) < 0) {\n    throw new IllegalStateException(\"Argument field not in input stream: \" + a);\n  }\n}","typeGuard":null,"tryCatchPattern":"try { trans.execute(null); trans.waitUntilFinished(); } catch (KettleException e) { /* inspect result rows / log for CouldNotFindField and fix mapping */ }","preventionTips":["Re-open the ExecSQL step after any upstream field rename","Preview input row fields before execution","Keep field names case-consistent across steps","Use Select values to standardize field names before ExecSQL"],"tags":["row-stream","field-mapping","kettle"],"backgroundTag":"resource-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"}