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
- 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.
- If the variable name uses substitution, verify the variable/expression resolves at runtime.
- Open the .ktr XML or repository record and remove empty variable entries that the dialog might hide.
- 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
- Remove blank rows from the Set Variables table before saving
- Give every variable row a non-empty Variable name
- Set a Default value when the field may be empty so the row stays valid
- Review saved .ktr XML for orphaned empty variable entries
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
- ChangeFileEncoding.Exception.TargetEncodingEmpty
- IfNull.Log.SelectFieldsEmpty
- IfNull.Log.SelectValueTypesEmpty
- KettleException(e)
- PurRepository.ERROR_0008_TRANSFORMATION_PATH_INVALID
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)