pentaho/pentaho-kettle · error · KettleException

Field [ ] is specified at least twice! (position and ...)

Error message

Field [{0}] is specified at least twice! (position {1} and {2} ...)

What it means

SetValueField.processRow() throws KettleException 'SetValueField.Log.FieldSpecifiedMoreThatOne' when the same field name appears more than once in the step's field array. Duplicate replace-by-value targets are rejected to avoid ambiguous overwrite order.

Solutions

  1. Open the 'Set Field Value' step and remove duplicate field entries
  2. Note this check is case-sensitive here — still remove exact duplicates only if that is the intent, but keep names unique case-insensitively for safety
  3. Re-save the transformation and re-run
  4. If two different replacements are needed for one field, split into two chained steps

Example fix

// before
fields: ['qty','qty']
// after
fields: ['qty']
Defensive patterns

Strategy: validation

Validate before calling

java.util.Set<String> seen = new java.util.HashSet<>();
for (String name : meta.getFieldName()) {
  if (!seen.add(name)) throw new IllegalStateException("Duplicate field configured: " + name);
}

Try / catch

try { step.processRow(); } catch (KettleException e) { if (e.getMessage().contains("specified at least twice")) { /* de-duplicate fields */ } else throw e; }

Prevention

When it happens

Trigger: First row processing when the O(n^2) name-equality loop finds i != j with meta.getFieldName()[i].equals(meta.getFieldName()[j]) — the same field listed twice in the Fields tab.

Common situations: Duplicated rows in the step's Fields grid; XML hand-edits that copied a <field> block; merging two transformations that both replace the same field.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/setvaluefield/SetValueField.java:74

      setOutputDone();
      return false;
    }

    if ( first ) {
      first = false;
      // What's the format of the output row?
      data.outputRowMeta = getInputRowMeta().clone();
      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,
        metaStore );

      data.indexOfField = new int[meta.getFieldName().length];
      data.indexOfReplaceByValue = new int[meta.getFieldName().length];
      for ( int i = 0; i < meta.getFieldName().length; i++ ) {
        // Check if this field was specified only one time
        for ( int j = 0; j < meta.getFieldName().length; j++ ) {
          if ( meta.getFieldName()[j].equals( meta.getFieldName()[i] ) ) {
            if ( j != i ) {
              throw new KettleException( BaseMessages.getString(
                PKG, "SetValueField.Log.FieldSpecifiedMoreThatOne", meta.getFieldName()[i], "" + i, "" + j ) );
            }
          }
        }

        data.indexOfField[i] = data.outputRowMeta.indexOfValue( environmentSubstitute( meta.getFieldName()[i] ) );
        if ( data.indexOfField[i] < 0 ) {
          throw new KettleStepException( BaseMessages.getString(
            PKG, "SetValueField.Log.CouldNotFindFieldInRow", meta.getFieldName()[i] ) );
        }
        String sourceField = environmentSubstitute(
          meta.getReplaceByFieldValue() != null && meta.getReplaceByFieldValue().length > 0
            ? meta.getReplaceByFieldValue()[i] : null
        );
        if ( Utils.isEmpty( sourceField ) ) {
          throw new KettleStepException( BaseMessages.getString(
            PKG, "SetValueField.Log.ReplaceByValueFieldMissing", "" + i ) );
        }

View on GitHub (pinned to f3058517a1)