pentaho/pentaho-kettle · error · KettleException

ScriptValuesDialogMod.Exception.CouldNotGetFields

Error message

ScriptValuesDialogMod.Exception.CouldNotGetFields

What it means

In ScriptValuesModDialog's test/preview path, when the step cannot produce input field metadata (getFields fails or returns no usable state) the dialog throws this KettleException keyed to message ScriptValuesDialogMod.Exception.CouldNotGetFields. It means field metadata required to run the 'Test script' feature could not be obtained from the surrounding transformation.

Solutions

  1. Connect the ScriptValues step to a valid upstream step before testing the script
  2. Ensure the previous step can resolve row metadata (run/preview the upstream step first)
  3. Check the hop between steps is enabled and correctly oriented
  4. If fields depend on other steps, verify those steps are configured

Example fix

// before: testing with no upstream hop
StepMeta prev = transMeta.findPreviousStep( stepMeta, true ); // returns null -> exception
// after: guard in dialog logic
if ( prev != null && transMeta.getPrevStepFields( stepMeta ) != null ) { testScript(); } else { showWarning( "Connect an input step first" ); }
Defensive patterns

Strategy: validation

Validate before calling

// Java: ensure a previous step exists and fields resolve before testing
StepMeta prev = transMeta.findPreviousStep( stepMeta, true );
boolean canTest = prev != null && transMeta.getPrevStepFields( stepMeta ) != null;

Type guard

boolean hasUpstreamFields = transMeta.findPreviousStep( stepMeta, true ) != null;

Try / catch

try { testScript(); } catch ( KettleException e ) { new ErrorDialog( shell, "Test failed", "Could not get fields", e ); }

Prevention

When it happens

Trigger: Clicking 'Test script' in the Script Values Mod dialog when the previous step is disconnected/absent or its fields cannot be resolved (prevInfo == null / getFieldInfo failure path where the else branch executes).

Common situations: Testing a script in a step that is not yet wired to an upstream step; upstream step returns no rows metadata; hop misconfigured; running dialog against a partially built transformation.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at ui/src/main/java/org/pentaho/di/ui/trans/steps/scriptvalues_mod/ScriptValuesModDialog.java:1273

              etd.setReadOnly();
              etd.open();
            }
          }

          RowMetaInterface previewRowsMeta = progressDialog.getPreviewRowsMeta( wStepname.getText() );
          List<Object[]> previewRows = progressDialog.getPreviewRows( wStepname.getText() );

          if ( previewRowsMeta != null && previewRows != null && previewRows.size() > 0 ) {
            PreviewRowsDialog prd =
              new PreviewRowsDialog(
                shell, transMeta, SWT.NONE, wStepname.getText(), previewRowsMeta, previewRows, loggingText );
            prd.open();
          }
        }

        return true;
      } else {
        throw new KettleException( BaseMessages.getString(
          PKG, "ScriptValuesDialogMod.Exception.CouldNotGetFields" ) );
      }
    } catch ( Exception e ) {
      new ErrorDialog(
        shell, BaseMessages.getString( PKG, "ScriptValuesDialogMod.TestFailed.DialogTitle" ), BaseMessages
          .getString( PKG, "ScriptValuesDialogMod.TestFailed.DialogMessage" ), e );
      return false;
    }

  }

  private boolean test( boolean getvars, boolean popup ) {
    boolean retval = true;
    StyledTextComp wScript = getStyledTextComp();
    String scr = wScript.getText();
    KettleException testException = null;

    Context jscx;

View on GitHub (pinned to f3058517a1)