{"record":{"id":"63dd4e3050a7c574","repo":"pentaho/pentaho-kettle","slug":"no-name-was-specified-for-result-value-i","errorCode":null,"errorMessage":"No name was specified for result value #{i}","messagePattern":"No name was specified for result value #(.+?)","errorType":"exception","errorClass":"KettleValueException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/script/Script.java","lineNumber":404,"sourceCode":"      throw new KettleValueException( BaseMessages.getString( PKG, \"Script.Log.JavascriptError\" ), e );\n    }\n    return bRC;\n  }\n\n  public Object getValueFromJScript( Object result, int i ) throws KettleValueException {\n    String fieldName = meta.getFieldname()[ i ];\n    if ( !Utils.isEmpty( fieldName ) ) {\n      // res.setName(meta.getRename()[i]);\n      // res.setType(meta.getType()[i]);\n\n      try {\n        return ( result == null ) ? null\n          : JavaScriptUtils.convertFromJs( result, meta.getType()[ i ], fieldName );\n      } catch ( Exception e ) {\n        throw new KettleValueException( BaseMessages.getString( PKG, \"Script.Log.JavascriptError\" ), e );\n      }\n    } else {\n      throw new KettleValueException( \"No name was specified for result value #\" + ( i + 1 ) );\n    }\n  }\n\n  public RowMetaInterface getOutputRowMeta() {\n    return data.outputRowMeta;\n  }\n\n  public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException {\n\n    meta = (ScriptMeta) smi;\n    data = (ScriptData) sdi;\n\n    Object[] r = getRow(); // Get row from input rowset & set row busy!\n    if ( r == null ) {\n      // Modification for Additional End Function\n      try {\n        if ( data.cx != null ) {\n          // Checking for EndScript","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/script/Script.java#L386-L422","documentation":"Kettle's Script step throws KettleValueException when generating an output value from a JavaScript result but no field name was configured for that result value index. The step iterates the configured result fields (meta.getFieldName()[i]); if the name slot is empty/null it cannot place the converted value into the output row, so it fails fast.","triggerScenarios":"Calling getValueFromJScript(i) for a result index i whose configured field name in the Script step metadata (meta.getFieldName()[i]) is null or empty. This happens when the transform's XML/dialog configuration declares a value of a given type but leaves the 'Field name' blank.","commonSituations":"Hand-edited or programmatically generated transformation ktr XML missing the <field_name> element; a step copied between transforms where the rename was lost; upgrading/migrating transforms where metadata mapping changed and name fields ended up empty.","solutions":["Open the Script step dialog and set a non-empty 'Field name' for every entry in the fields grid","Edit the .ktr XML and ensure each <field> under the Script step has a populated <field_name> element","Verify programmatically: iterate meta.getFieldName() and reject null/blank names before execution","If the field is not needed, remove the whole field entry rather than leaving the name blank"],"exampleFix":"// before (ktr metadata)\n<field>\n  <field_name></field_name>\n  <field_type>String</field_type>\n</field>\n// after\n<field>\n  <field_name>resultValue</field_name>\n  <field_type>String</field_type>\n</field>","handlingStrategy":"validation","validationCode":"for (int i = 0; i < meta.getFieldName().length; i++) {\n  if (meta.getFieldName()[i] == null || meta.getFieldName()[i].trim().isEmpty()) {\n    throw new IllegalArgumentException(\"Result value #\" + (i + 1) + \" has no field name\");\n  }\n}","typeGuard":"boolean hasFieldName(ScriptMeta meta, int i) {\n  return i < meta.getFieldName().length\n    && meta.getFieldName()[i] != null\n    && !meta.getFieldName()[i].trim().isEmpty();\n}","tryCatchPattern":"try {\n  Object v = script.getValueFromJScript(i);\n} catch (KettleValueException e) {\n  logError(\"Result field name missing or JS error: \" + e.getMessage());\n  throw e;\n}","preventionTips":["Always fill the Field name column for every row in the Script step fields grid","Validate transform metadata (null/blank field names) before running in CI","Avoid hand-editing .ktr XML; use the dialog or Metadata editor","After copying steps between transforms, re-check the fields grid"],"tags":["kettle","script-step","configuration","missing-field-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"}