{"record":{"id":"b6b3bbab6b2e8e60","repo":"pentaho/pentaho-kettle","slug":"calculator-error-nonamefield","errorCode":"Calculator.Error.NoNameField","errorMessage":"Calculator.Error.NoNameField","messagePattern":"Calculator\\.Error\\.NoNameField","errorType":"error_code","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/calculator/Calculator.java","lineNumber":101,"sourceCode":"      List<Integer> tempIndexes = new ArrayList<Integer>();\n\n      // Calculate the indexes of the values and arguments in the target data or temporary data\n      // We do this in advance to save time later on.\n      //\n      //CHECKSTYLE:Indentation:OFF\n      for ( int i = 0; i < meta.getCalculation().length; i++ ) {\n        CalculatorMetaFunction function = meta.getCalculation()[i];\n        data.getFieldIndexes()[i] = new FieldIndexes();\n\n        if ( !Utils.isEmpty( function.getFieldName() ) ) {\n          data.getFieldIndexes()[i].indexName = data.getCalcRowMeta().indexOfValue( function.getFieldName() );\n          if ( data.getFieldIndexes()[i].indexName < 0 ) {\n            // Nope: throw an exception\n            throw new KettleStepException( BaseMessages.getString(\n              PKG, \"Calculator.Error.UnableFindField\", function.getFieldName(), \"\" + ( i + 1 ) ) );\n          }\n        } else {\n          throw new KettleStepException( BaseMessages.getString( PKG, \"Calculator.Error.NoNameField\", \"\"\n            + ( i + 1 ) ) );\n        }\n\n        if ( !Utils.isEmpty( function.getFieldA() ) ) {\n          if ( function.getCalcType() != CalculatorMetaFunction.CALC_CONSTANT ) {\n            data.getFieldIndexes()[i].indexA = data.getCalcRowMeta().indexOfValue( function.getFieldA() );\n            if ( data.getFieldIndexes()[i].indexA < 0 ) {\n              // Nope: throw an exception\n              throw new KettleStepException( \"Unable to find the first argument field '\"\n                + function.getFieldName() + \" for calculation #\" + ( i + 1 ) );\n            }\n          } else {\n            data.getFieldIndexes()[i].indexA = -1;\n          }\n        } else {\n          throw new KettleStepException( \"There is no first argument specified for calculated field #\" + ( i + 1 ) );\n        }\n","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/calculator/Calculator.java#L83-L119","documentation":"Each Calculator calculation must have a source field name (except for constants handled elsewhere). If function.getFieldName() is empty or null for calculation #N, the step cannot resolve it and processRow throws KettleStepException with localized key Calculator.Error.NoNameField. This enforces that every configured calculation row names its input field.","triggerScenarios":"processRow, first-row init: a calculation row in CalculatorMeta has an empty/null fieldName while the calculation type still requires an input field.","commonSituations":"Adding a calculation line in the Calculator dialog and forgetting to pick the field; deleting the field text but leaving the calculation type; programmatically building CalculatorMetaFunction without setting fieldName.","solutions":["Open the Calculator step and set the missing field on calculation #N","Delete the empty calculation row if it is not needed","When building meta in code, call setFieldName(...) on every CalculatorMetaFunction"],"exampleFix":"// before\nnew CalculatorMetaFunction(null, calcType, null, null, null, \"target\", ...); // no field name\n// after\nnew CalculatorMetaFunction(\"amount\", calcType, \"amount\", null, null, \"target\", ...);","handlingStrategy":"validation","validationCode":"for (int i = 0; i < functions.size(); i++) {\n  CalculatorMetaFunction fn = functions.get(i);\n  if (fn.getCalcType() != CalculatorMetaFunction.CALC_CONSTANT && Utils.isEmpty(fn.getFieldName()))\n    throw new IllegalArgumentException(\"Calc #\" + (i+1) + \" has no field name\");\n}","typeGuard":null,"tryCatchPattern":"catch (KettleStepException e) { if (e.getMessage().contains(\"NoNameField\") || e.getMessage().contains(\"no name\")) { /* fill the empty field in calc #N */ } throw e; }","preventionTips":["Fill both the field name and value type on every Calculator line","Delete unused calculation rows instead of blanking their fields","Validate meta programmatically when building steps in Java"],"tags":["kettle","pdi","calculator","missing-field"],"backgroundTag":"missing-required-argument","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"}