pentaho/pentaho-kettle · error · KettleStepException

Calculator.Error.NoNameField

Calculator.Error.NoNameField

Error message

Calculator.Error.NoNameField

What it means

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.

Solutions

  1. Open the Calculator step and set the missing field on calculation #N
  2. Delete the empty calculation row if it is not needed
  3. When building meta in code, call setFieldName(...) on every CalculatorMetaFunction

Example fix

// before
new CalculatorMetaFunction(null, calcType, null, null, null, "target", ...); // no field name
// after
new CalculatorMetaFunction("amount", calcType, "amount", null, null, "target", ...);
Defensive patterns

Strategy: validation

Validate before calling

for (int i = 0; i < functions.size(); i++) {
  CalculatorMetaFunction fn = functions.get(i);
  if (fn.getCalcType() != CalculatorMetaFunction.CALC_CONSTANT && Utils.isEmpty(fn.getFieldName()))
    throw new IllegalArgumentException("Calc #" + (i+1) + " has no field name");
}

Try / catch

catch (KettleStepException e) { if (e.getMessage().contains("NoNameField") || e.getMessage().contains("no name")) { /* fill the empty field in calc #N */ } throw e; }

Prevention

When it happens

Trigger: processRow, first-row init: a calculation row in CalculatorMeta has an empty/null fieldName while the calculation type still requires an input field.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/b6b3bbab6b2e8e60. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/calculator/Calculator.java:101

      List<Integer> tempIndexes = new ArrayList<Integer>();

      // Calculate the indexes of the values and arguments in the target data or temporary data
      // We do this in advance to save time later on.
      //
      //CHECKSTYLE:Indentation:OFF
      for ( int i = 0; i < meta.getCalculation().length; i++ ) {
        CalculatorMetaFunction function = meta.getCalculation()[i];
        data.getFieldIndexes()[i] = new FieldIndexes();

        if ( !Utils.isEmpty( function.getFieldName() ) ) {
          data.getFieldIndexes()[i].indexName = data.getCalcRowMeta().indexOfValue( function.getFieldName() );
          if ( data.getFieldIndexes()[i].indexName < 0 ) {
            // Nope: throw an exception
            throw new KettleStepException( BaseMessages.getString(
              PKG, "Calculator.Error.UnableFindField", function.getFieldName(), "" + ( i + 1 ) ) );
          }
        } else {
          throw new KettleStepException( BaseMessages.getString( PKG, "Calculator.Error.NoNameField", ""
            + ( i + 1 ) ) );
        }

        if ( !Utils.isEmpty( function.getFieldA() ) ) {
          if ( function.getCalcType() != CalculatorMetaFunction.CALC_CONSTANT ) {
            data.getFieldIndexes()[i].indexA = data.getCalcRowMeta().indexOfValue( function.getFieldA() );
            if ( data.getFieldIndexes()[i].indexA < 0 ) {
              // Nope: throw an exception
              throw new KettleStepException( "Unable to find the first argument field '"
                + function.getFieldName() + " for calculation #" + ( i + 1 ) );
            }
          } else {
            data.getFieldIndexes()[i].indexA = -1;
          }
        } else {
          throw new KettleStepException( "There is no first argument specified for calculated field #" + ( i + 1 ) );
        }

View on GitHub (pinned to f3058517a1)