pentaho/pentaho-kettle · error · KettleValueException

No name was specified for result value #

Error message

No name was specified for result value #

What it means

Thrown by getValueFromJScript() when a result value entry has no field name configured. If meta.getFieldname()[i] is null or empty, the method cannot label or store the converted value and throws a KettleValueException 'No name was specified for result value #N' (1-based index). This is a step-metadata configuration error, not a script problem.

Solutions

  1. Open the Modified Java Script Value step dialog and fill in the missing Field name for row N
  2. Remove the empty result-field row if the value is not needed
  3. If building meta via API, call meta.setFieldname(...) with a non-empty name for every entry
  4. Re-export/check the transformation XML to ensure fieldname attributes are present
  5. Validate step metadata with the step's built-in verification before running

Example fix

// before: meta built without a name
meta.allocate( 1 );
meta.getFieldname()[ 0 ] = null;
// after
meta.allocate( 1 );
meta.getFieldname()[ 0 ] = "resultValue";
Defensive patterns

Strategy: validation

Validate before calling

// Validate all result field names are non-empty before running the transformation
String[] names = meta.getFieldname();
for ( int i = 0; i < names.length; i++ ) {
  if ( names[ i ] == null || names[ i ].trim().isEmpty() ) {
    throw new IllegalStateException( "Result field #" + ( i + 1 ) + " has no name" );
  }
}

Try / catch

try {
  runTransformation();
} catch ( KettleValueException e ) {
  if ( e.getMessage().startsWith( "No name was specified for result value" ) ) {
    logError( "Fix the empty Field name in the Modified Java Script Value step" );
  }
  throw e;
}

Prevention

When it happens

Trigger: The Modified Java Script Value step defines a result field whose 'Field name' column is blank; during valueData() the empty name is detected in getValueFromJScript for index i.

Common situations: User added a row in the step's fields grid but left the name empty, an import/paste of step XML lost the fieldname attribute, or a programmatic meta construction (via API) skipped setting fieldnames.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMod.java:487

      throw new KettleValueException( BaseMessages.getString( PKG, "ScriptValuesMod.Log.JavascriptError" ), e );
    }
    return bRC;
  }

  public Object getValueFromJScript( Object result, int i ) throws KettleValueException {
    String fieldName = meta.getFieldname()[ i ];
    if ( !Utils.isEmpty( fieldName ) ) {
      // res.setName(meta.getRename()[i]);
      // res.setType(meta.getType()[i]);

      try {
        return ( result == null ) ? null
          : JavaScriptUtils.convertFromJs( result, meta.getType()[ i ], fieldName );
      } catch ( Exception e ) {
        throw new KettleValueException( BaseMessages.getString( PKG, "ScriptValuesMod.Log.JavascriptError" ), e );
      }
    } else {
      throw new KettleValueException( "No name was specified for result value #" + ( i + 1 ) );
    }
  }

  public RowMetaInterface getOutputRowMeta() {
    return data.outputRowMeta;
  }

  public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException {

    meta = (ScriptValuesMetaMod) smi;
    data = (ScriptValuesModData) sdi;

    Object[] r = getRow(); // Get row from input rowset & set row busy!
    if ( r == null ) {
      // Modification for Additional End Function
      try {
        if ( data.cx != null ) {
          // Checking for EndScript

View on GitHub (pinned to f3058517a1)