{"record":{"id":"36dc8819517b3fe3","repo":"pentaho/pentaho-kettle","slug":"field-0-is-specified-at-least-twice-position-1-and-2-36dc88","errorCode":null,"errorMessage":"Field [{0}] is specified at least twice! (position {1} and {2} ...)","messagePattern":"Field \\[(.+?)\\] is specified at least twice! \\(position (.+?) and (.+?) \\.\\.\\.\\)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/setvaluefield/SetValueField.java","lineNumber":74,"sourceCode":"      setOutputDone();\n      return false;\n    }\n\n    if ( first ) {\n      first = false;\n      // What's the format of the output row?\n      data.outputRowMeta = getInputRowMeta().clone();\n      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n        metaStore );\n\n      data.indexOfField = new int[meta.getFieldName().length];\n      data.indexOfReplaceByValue = new int[meta.getFieldName().length];\n      for ( int i = 0; i < meta.getFieldName().length; i++ ) {\n        // Check if this field was specified only one time\n        for ( int j = 0; j < meta.getFieldName().length; j++ ) {\n          if ( meta.getFieldName()[j].equals( meta.getFieldName()[i] ) ) {\n            if ( j != i ) {\n              throw new KettleException( BaseMessages.getString(\n                PKG, \"SetValueField.Log.FieldSpecifiedMoreThatOne\", meta.getFieldName()[i], \"\" + i, \"\" + j ) );\n            }\n          }\n        }\n\n        data.indexOfField[i] = data.outputRowMeta.indexOfValue( environmentSubstitute( meta.getFieldName()[i] ) );\n        if ( data.indexOfField[i] < 0 ) {\n          throw new KettleStepException( BaseMessages.getString(\n            PKG, \"SetValueField.Log.CouldNotFindFieldInRow\", meta.getFieldName()[i] ) );\n        }\n        String sourceField = environmentSubstitute(\n          meta.getReplaceByFieldValue() != null && meta.getReplaceByFieldValue().length > 0\n            ? meta.getReplaceByFieldValue()[i] : null\n        );\n        if ( Utils.isEmpty( sourceField ) ) {\n          throw new KettleStepException( BaseMessages.getString(\n            PKG, \"SetValueField.Log.ReplaceByValueFieldMissing\", \"\" + i ) );\n        }","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/setvaluefield/SetValueField.java#L56-L92","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the 'Set Field Value' step and remove duplicate field entries","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","Re-save the transformation and re-run","If two different replacements are needed for one field, split into two chained steps"],"exampleFix":"// before\nfields: ['qty','qty']\n// after\nfields: ['qty']","handlingStrategy":"validation","validationCode":"java.util.Set<String> seen = new java.util.HashSet<>();\nfor (String name : meta.getFieldName()) {\n  if (!seen.add(name)) throw new IllegalStateException(\"Duplicate field configured: \" + name);\n}","typeGuard":null,"tryCatchPattern":"try { step.processRow(); } catch (KettleException e) { if (e.getMessage().contains(\"specified at least twice\")) { /* de-duplicate fields */ } else throw e; }","preventionTips":["Keep the Fields grid free of duplicate rows","Avoid copying <field> blocks when hand-editing XML","Uniqueness-check field lists programmatically before runs","Note the check is case-sensitive; still keep names unique case-insensitively"],"tags":["kettle","duplicate-field","configuration"],"backgroundTag":"conflicting-config-options","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"}