pentaho/pentaho-kettle · error · KettleException

Variable name nor value was specified on line #

Error message

Variable name nor value was specified on line #

What it means

After reading the field value, SetVariable.setValue reads meta.getVariableName()[i] and validates it. If the variable name is empty, the step cannot know which environment variable to set; when the value is also empty it throws this exception, otherwise it throws the sibling 'no variable name specified for value' error. It is a step-configuration completeness check.

Solutions

  1. Open the Set Variables step and fill in the 'Variable name' (and pick a field or default value) for row (i+1) reported in the message; delete the row if it's unneeded.
  2. If the variable name uses substitution, verify the variable/expression resolves at runtime.
  3. Open the .ktr XML or repository record and remove empty variable entries that the dialog might hide.
  4. Run the transformation in Spoon with detailed logging to see the exact line number before production runs.

Example fix

// before (step metadata)
variableName[0] = ""; fieldName[0] = ""; // empty row
// after
variableName[0] = "INTERNAL.MY_VAR"; fieldName[0] = "env";
Defensive patterns

Strategy: validation

Validate before calling

for (int i = 0; i < meta.getVariableName().length; i++) {
  if (Utils.isEmpty(meta.getVariableName()[i])
      && Utils.isEmpty(meta.getDefaultValue()[i])) {
    throw new IllegalStateException("Variable row " + (i + 1) + " has neither name nor value");
  }
}

Try / catch

try {
  trans.execute(null);
} catch (KettleException e) {
  if (e.getMessage().startsWith("Variable name nor value")) {
    log.error("Empty variable row in Set Variables config");
  }
}

Prevention

When it happens

Trigger: setValue: varname = meta.getVariableName()[i]; if Utils.isEmpty(varname) and Utils.isEmpty(value) -> throw KettleException("Variable name nor value was specified on line #" + (i+1)). Triggered when a variable row exists in the step config with neither Variable name nor a resolvable field/default value.

Common situations: A blank row was added to the Set Variables table and left empty; XML/repository metadata contains an extra empty variable entry; a variable-name expression referencing an undefined variable resolved to empty; partial deletion of a variable configuration.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/setvariable/SetVariable.java:125

      //
      if ( meta.isUsingFormatting() ) {
        value = valueMeta.getString( valueData );
      } else {
        value = valueMeta.getCompatibleString( valueData );
      }

    }

    if ( value == null ) {
      value = "";
    }

    // Get variable name
    String varname = meta.getVariableName()[i];

    if ( Utils.isEmpty( varname ) ) {
      if ( Utils.isEmpty( value ) ) {
        throw new KettleException( "Variable name nor value was specified on line #" + ( i + 1 ) );
      } else {
        throw new KettleException( "There was no variable name specified for value [" + value + "]" );
      }
    }

    Job parentJob = null;

    // We always set the variable in this step and in the parent transformation...
    //
    setVariable( varname, value );

    // Set variable in the transformation
    //
    Trans trans = getTrans();
    trans.setVariable( varname, value );

    // Make a link between the transformation and the parent transformation (in a sub-transformation)
    //

View on GitHub (pinned to f3058517a1)