{"record":{"id":"b20b51566fa5a72b","repo":"pentaho/pentaho-kettle","slug":"field-0-is-specified-at-least-twice-position-1-and-2","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/setvalueconstant/SetValueConstant.java","lineNumber":87,"sourceCode":"      // Create convert meta-data objects that will contain Date & Number formatters\n      // data.convertRowMeta = data.outputRowMeta.clone();\n\n      // For String to <type> conversions, we allocate a conversion meta data row as well...\n      //\n      data.setConvertRowMeta( data.getOutputRowMeta().cloneToType( ValueMetaInterface.TYPE_STRING ) );\n\n      // Consider only selected fields\n      List<SetValueConstantMeta.Field> fields = meta.getFields();\n      int size = fields.size();\n      if ( !Utils.isEmpty( fields ) ) {\n        data.setFieldnrs( new int[size] );\n        data.setRealReplaceByValues( new String[size] );\n        for ( int i = 0; i < size; i++ ) {\n          // Check if this field was specified only one time\n          final SetValueConstantMeta.Field check = fields.get( i );\n          for ( SetValueConstantMeta.Field field : fields ) {\n            if ( field.getFieldName() != null && field != check && field.getFieldName().equalsIgnoreCase( check.getFieldName() ) ) {\n              throw new KettleException( BaseMessages.getString( PKG, \"SetValueConstant.Log\"\n                      + \".FieldSpecifiedMoreThatOne\", check.getFieldName() ) );\n            }\n          }\n\n          data.getFieldnrs()[i] = data.getOutputRowMeta().indexOfValue( meta.getField( i ).getFieldName() );\n\n          if ( data.getFieldnrs()[i] < 0 ) {\n            logError( BaseMessages.getString( PKG, \"SetValueConstant.Log.CanNotFindField\", meta.getField( i ).getFieldName() ) );\n            throw new KettleException( BaseMessages.getString( PKG, \"SetValueConstant.Log.CanNotFindField\", meta\n              .getField( i ).getFieldName() ) );\n          }\n\n          if ( meta.getField( i ).isEmptyString() ) {\n            // Just set empty string\n            data.getRealReplaceByValues()[i] = StringUtil.EMPTY_STRING;\n          } else {\n            // set specified value\n            if ( meta.isUseVars() ) {","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/setvalueconstant/SetValueConstant.java#L69-L105","documentation":"SetValueConstant.processRow() throws KettleException 'SetValueConstant.Log.FieldSpecifiedMoreThatOne' when the same field name is configured more than once in the step. Duplicate replacement targets would cause non-deterministic overwrite order, so the step refuses to run.","triggerScenarios":"First row processing (first==true) when the inner loop finds two Field entries with equal (case-insensitive, non-null) field names in the step's field list.","commonSituations":"Hand-editing the transformation XML or duplicating a row in the Fields grid; merging transformations that both set a constant on the same field.","solutions":["Open the 'Set Value Constant' step and delete/merge the duplicate field rows","Compare field names case-insensitively — 'Name' and 'name' still collide","Re-save the transformation and re-run","If both constants are intentionally different, use two chained steps"],"exampleFix":"// before\nfields: [{name:'status', value:'A'}, {name:'STATUS', value:'B'}]\n// after\nfields: [{name:'status', value:'B'}]","handlingStrategy":"validation","validationCode":"java.util.Set<String> seen = new java.util.HashSet<>();\nfor (SetValueConstantMeta.Field f : meta.getField()) {\n  if (f.getFieldName() != null && !seen.add(f.getFieldName().toLowerCase()))\n    throw new IllegalStateException(\"Duplicate field configured: \" + f.getFieldName());\n}","typeGuard":null,"tryCatchPattern":"try { step.processRow(); } catch (KettleException e) { if (e.getMessage().contains(\"specified at least twice\")) { /* reconfigure fields */ } else throw e; }","preventionTips":["Review the Fields grid for duplicated rows before saving","Keep names unique case-insensitively","Avoid hand-editing transformation XML","Use code review for merged transformations"],"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"}