{"record":{"id":"c599655011c4c524","repo":"pentaho/pentaho-kettle","slug":"variable-name-nor-value-was-specified-on-line","errorCode":null,"errorMessage":"Variable name nor value was specified on line #","messagePattern":"Variable name nor value was specified on line #","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/setvariable/SetVariable.java","lineNumber":125,"sourceCode":"      //\n      if ( meta.isUsingFormatting() ) {\n        value = valueMeta.getString( valueData );\n      } else {\n        value = valueMeta.getCompatibleString( valueData );\n      }\n\n    }\n\n    if ( value == null ) {\n      value = \"\";\n    }\n\n    // Get variable name\n    String varname = meta.getVariableName()[i];\n\n    if ( Utils.isEmpty( varname ) ) {\n      if ( Utils.isEmpty( value ) ) {\n        throw new KettleException( \"Variable name nor value was specified on line #\" + ( i + 1 ) );\n      } else {\n        throw new KettleException( \"There was no variable name specified for value [\" + value + \"]\" );\n      }\n    }\n\n    Job parentJob = null;\n\n    // We always set the variable in this step and in the parent transformation...\n    //\n    setVariable( varname, value );\n\n    // Set variable in the transformation\n    //\n    Trans trans = getTrans();\n    trans.setVariable( varname, value );\n\n    // Make a link between the transformation and the parent transformation (in a sub-transformation)\n    //","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/setvariable/SetVariable.java#L107-L143","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (step metadata)\nvariableName[0] = \"\"; fieldName[0] = \"\"; // empty row\n// after\nvariableName[0] = \"INTERNAL.MY_VAR\"; fieldName[0] = \"env\";","handlingStrategy":"validation","validationCode":"for (int i = 0; i < meta.getVariableName().length; i++) {\n  if (Utils.isEmpty(meta.getVariableName()[i])\n      && Utils.isEmpty(meta.getDefaultValue()[i])) {\n    throw new IllegalStateException(\"Variable row \" + (i + 1) + \" has neither name nor value\");\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  trans.execute(null);\n} catch (KettleException e) {\n  if (e.getMessage().startsWith(\"Variable name nor value\")) {\n    log.error(\"Empty variable row in Set Variables config\");\n  }\n}","preventionTips":["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"],"tags":["kettle","set-variables","empty-config","variables"],"backgroundTag":"empty-required-field","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"}