{"record":{"id":"d819306274f709be","repo":"pentaho/pentaho-kettle","slug":"unable-to-find-the-third-argument-field-0-for-calculation-1","errorCode":null,"errorMessage":"Unable to find the third argument field '{0} for calculation #{1}","messagePattern":"Unable to find the third argument field '(.+?) for calculation #(.+?)","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/calculator/Calculator.java","lineNumber":133,"sourceCode":"          }\n        } else {\n          throw new KettleStepException( \"There is no first argument specified for calculated field #\" + ( i + 1 ) );\n        }\n\n        if ( !Utils.isEmpty( function.getFieldB() ) ) {\n          data.getFieldIndexes()[i].indexB = data.getCalcRowMeta().indexOfValue( function.getFieldB() );\n          if ( data.getFieldIndexes()[i].indexB < 0 ) {\n            // Nope: throw an exception\n            throw new KettleStepException( \"Unable to find the second argument field '\"\n              + function.getFieldName() + \" for calculation #\" + ( i + 1 ) );\n          }\n        }\n        data.getFieldIndexes()[i].indexC = -1;\n        if ( !Utils.isEmpty( function.getFieldC() ) ) {\n          data.getFieldIndexes()[i].indexC = data.getCalcRowMeta().indexOfValue( function.getFieldC() );\n          if ( data.getFieldIndexes()[i].indexC < 0 ) {\n            // Nope: throw an exception\n            throw new KettleStepException( \"Unable to find the third argument field '\"\n              + function.getFieldName() + \" for calculation #\" + ( i + 1 ) );\n          }\n        }\n\n        if ( function.isRemovedFromResult() ) {\n          tempIndexes.add( getInputRowMeta().size() + i );\n        }\n      }\n\n      // Convert temp indexes to int[]\n      data.setTempIndexes( new int[tempIndexes.size()] );\n      for ( int i = 0; i < data.getTempIndexes().length; i++ ) {\n        data.getTempIndexes()[i] = tempIndexes.get( i );\n      }\n    }\n\n    if ( log.isRowLevel() ) {\n      logRowlevel( BaseMessages.getString( PKG, \"Calculator.Log.ReadRow\" )","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/calculator/Calculator.java#L115-L151","documentation":"For calculations that use a third argument (e.g. IsNA(a,b,c), NVL-like functions), Calculator resolves fieldC against the input row metadata. If fieldC is non-empty but indexOfValue returns < 0, processRow throws KettleStepException 'Unable to find the third argument field ... for calculation #N'.","triggerScenarios":"processRow init: function.getFieldC() is set but the named field is absent from data.getCalcRowMeta().","commonSituations":"Three-argument calculations (e.g. IF/round with precision) referencing a field that was renamed or filtered out upstream; typo in the 'Third argument field' box.","solutions":["Correct 'Third argument field' in calculation #N to an existing input field","Clear field C if the calculation type does not actually need it","Preview the upstream step and re-pick the field name"],"exampleFix":"// before\nfn.setFieldC(\"default_val\"); // upstream field is \"defaultValue\"\n// after\nfn.setFieldC(\"defaultValue\");","handlingStrategy":"validation","validationCode":"if (!Utils.isEmpty(fn.getFieldC()) && calcRowMeta.indexOfValue(fn.getFieldC()) < 0)\n  throw new IllegalArgumentException(\"Calc fieldC not in input: \" + fn.getFieldC());","typeGuard":null,"tryCatchPattern":"catch (KettleStepException e) { /* open the calculation named in the message and fix field C */ throw e; }","preventionTips":["Only populate field C for three-argument calculation types","Confirm upstream still emits the field used as the third argument","Preview input rows before running the full transformation"],"tags":["kettle","pdi","calculator","field-mapping"],"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"}