pentaho/pentaho-kettle · error · KettleException

TransformClassBase.Exception.UnableToFindTargetStepNameForTa…

Error message

TransformClassBase.Exception.UnableToFindTargetStepNameForTag

What it means

Thrown by TransformClassBase.findTargetRowSet(tag) when the given target tag is not mapped to any step name in data.targetMap. Target tags must be declared (e.g. addTargetSource or target step mappings) before the script can retrieve their rowset.

Solutions

  1. Declare the tag as a target in the UDJC step dialog (or addTargetSource) so it maps to a step name.
  2. Correct the tag string used in findTargetRowSet to match a registered target tag.
  3. Confirm the target step hop still exists in the transformation.

Example fix

// before
RowSet rs = findTargetRowSet("outputA"); // not registered
// after
addTargetSource("outputA", "Output Step A");
RowSet rs = findTargetRowSet("outputA");
Defensive patterns

Strategy: validation

Validate before calling

if (tag != null) { Object o = data.targetMap.get(tag); if (o == null || o.toString().isEmpty()) throw new KettleException("Target tag not mapped: " + tag); }

Type guard

boolean isTargetMapped(String tag) { return tag != null && data.targetMap.get(tag) != null && !data.targetMap.get(tag).toString().isEmpty(); }

Try / catch

try { RowSet rs = findTargetRowSet(tag); ... } catch (KettleException e) { logError("Target tag not mapped: " + tag, e); throw e; }

Prevention

When it happens

Trigger: Calling findTargetRowSet("myTag") with a tag never added as a target definition, or with a tag whose mapping was removed/renamed in the step's target configuration.

Common situations: Typo in the tag; deleting a target hop in Spoon while the script still looks up the old tag; script copied from another transformation with different target definitions.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — 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/987388351f8e7da2. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/userdefinedjavaclass/TransformClassBase.java:592

    if ( Utils.isEmpty( stepname ) ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "TransformClassBase.Exception.UnableToFindInfoStepNameForTag", tag ) );
    }
    RowSet rowSet = findInputRowSet( stepname );
    if ( rowSet == null ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "TransformClassBase.Exception.UnableToFindInfoRowSetForStep", stepname ) );
    }
    return rowSet;
  }

  public RowSet findTargetRowSet( String tag ) throws KettleException {
    if ( tag == null ) {
      return null;
    }
    String stepname = data.targetMap.get( tag );
    if ( Utils.isEmpty( stepname ) ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "TransformClassBase.Exception.UnableToFindTargetStepNameForTag", tag ) );
    }
    RowSet rowSet = findOutputRowSet( stepname );
    if ( rowSet == null ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "TransformClassBase.Exception.UnableToFindTargetRowSetForStep", stepname ) );
    }
    return rowSet;
  }

  private final Map<String, FieldHelper> inFieldHelpers = new HashMap<String, FieldHelper>();
  private final Map<String, FieldHelper> infoFieldHelpers = new HashMap<String, FieldHelper>();
  private final Map<String, FieldHelper> outFieldHelpers = new HashMap<String, FieldHelper>();

  public enum Fields {
    In, Out, Info;
  }

View on GitHub (pinned to f3058517a1)