{"record":{"id":"5bda0626e32c651f","repo":"pentaho/pentaho-kettle","slug":"there-was-no-variable-name-specified-for-value","errorCode":null,"errorMessage":"There was no variable name specified for value [","messagePattern":"There was no variable name specified for value \\[","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/setvariable/SetVariable.java","lineNumber":127,"sourceCode":"        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    //\n    while ( trans.getParentTrans() != null ) {\n      trans = trans.getParentTrans();","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/setvariable/SetVariable.java#L109-L145","documentation":"The Set Variable step iterates its configured fields and requires each field to have a target variable name. When the variable name field is empty but a value is present, the step aborts with this KettleException. It is a metadata validation error thrown during processRow via setValue.","triggerScenarios":"A row is processed where field index i has a non-empty value but meta.getVariableName()[i] is null or empty (Utils.isEmpty).","commonSituations":"A developer added a field to the Set Variable step in Spoon but left the 'Variable name' column blank; a saved transformation had the variable name cleared or not migrated by an older version.","solutions":["Open the Set Variable step dialog and fill in the Variable name for every mapped field","Check field i corresponds to the row line shown and fix off-by-one field mapping","Verify the transformation metadata XML/repository rows contain non-empty variable_name attributes","Add a precondition check or Select Values step to ensure the variable-name source column is populated"],"exampleFix":"// before (step meta)\nfield[] = { name=\"amount\", variable=\"\" }\n// after\nfield[] = { name=\"amount\", variable=\"AMOUNT\" }","handlingStrategy":"validation","validationCode":"// before executing the transformation, validate step meta\nfor (SetVariableMeta sv : setVariableSteps) {\n  for (int i = 0; i < sv.getFieldName().length; i++) {\n    if (sv.getFieldName()[i] != null && (sv.getVariableName()[i] == null || sv.getVariableName()[i].isEmpty()))\n      throw new IllegalArgumentException(\"Field \" + sv.getFieldName()[i] + \" has no variable name\");\n  }\n}","typeGuard":"boolean hasVariableName(String name) { return name != null && !name.trim().isEmpty(); }","tryCatchPattern":"try { trans.execute(null); } catch (KettleException e) { if (e.getMessage().contains(\"no variable name specified\")) { /* fix step meta or skip */ } else throw e; }","preventionTips":["Always fill the Variable name column when adding fields in the Set Variable dialog","Run transformation meta validation (getFields/check) before execution","Keep variable names in shared metadata to avoid blank entries"],"tags":["kettle","pdi","set-variable","missing-variable-name"],"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"}