{"record":{"id":"249017f9fb615df9","repo":"apache/seatunnel","slug":"duplicate-nodename-definition-found-in-the-co","errorCode":null,"errorMessage":"Duplicate '${nodeName}' definition found in the configuration.","messagePattern":"Duplicate '(.+?)' definition found in the configuration\\.","errorType":"validation","errorClass":"InvalidConfigurationException","httpStatus":null,"severity":"error","filePath":"seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/YamlSeaTunnelDomConfigProcessor.java","lineNumber":77,"sourceCode":"import static com.hazelcast.internal.config.DomConfigHelper.getIntegerValue;\n\n/** Builds {@link SeaTunnelConfig} from the YAML DOM tree used by the engine startup path. */\npublic class YamlSeaTunnelDomConfigProcessor extends AbstractDomConfigProcessor {\n    private static final ILogger LOGGER = Logger.getLogger(YamlSeaTunnelDomConfigProcessor.class);\n\n    private final SeaTunnelConfig config;\n\n    YamlSeaTunnelDomConfigProcessor(boolean domLevel3, SeaTunnelConfig config) {\n        super(domLevel3);\n        this.config = config;\n    }\n\n    @Override\n    public void buildConfig(Node rootNode) {\n        for (Node node : childElements(rootNode)) {\n            String nodeName = cleanNodeName(node);\n            if (occurrenceSet.contains(nodeName)) {\n                throw new InvalidConfigurationException(\n                        \"Duplicate '\" + nodeName + \"' definition found in the configuration.\");\n            }\n            if (handleNode(node, nodeName)) {\n                continue;\n            }\n            if (!SeaTunnelConfigSections.canOccurMultipleTimes(nodeName)) {\n                occurrenceSet.add(nodeName);\n            }\n        }\n    }\n\n    private boolean handleNode(Node node, String name) {\n        if (SeaTunnelConfigSections.ENGINE.isEqual(name)) {\n            parseEngineConfig(node, config);\n        } else {\n            return true;\n        }\n        return false;","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/YamlSeaTunnelDomConfigProcessor.java#L59-L95","documentation":"YamlSeaTunnelDomConfigProcessor.buildConfig walks the config DOM and tracks seen node names; a key that appears twice at a level where duplicates are not allowed (not in canOccurMultipleTimes) triggers InvalidConfigurationException naming the duplicated key.","triggerScenarios":"buildConfig(rootNode) on a parsed seatunnel.yaml containing the same section/key twice at the same level (e.g. two merged documents, duplicated slot-service blocks).","commonSituations":"Config merge that concatenated two full documents instead of merging keys; copy-paste adding a second copy of a section; tooling appending a key that already exists.","solutions":["Find the duplicated key from the message and merge the two blocks into one.","Merge configs key-wise programmatically instead of concatenating text.","Verify post-merge that each top-level key occurs only once unless allowed multiple times."],"exampleFix":"# before\nslot-service:\n  dynamic-slot: true\nslot-service:\n  slot-num: 5\n# after\nslot-service:\n  dynamic-slot: true\n  slot-num: 5","handlingStrategy":"validation","validationCode":"Set<String> seen = new HashSet<>();\nfor (Object key : topLevelKeys(cfgText)) {\n    if (!seen.add(key)) throw new IllegalStateException(\"duplicate top-level key: \" + key);\n}","typeGuard":null,"tryCatchPattern":"try {\n    processor.buildConfig(rootNode);\n} catch (InvalidConfigurationException e) {\n    LOG.severe(\"Fix duplicated key in config: \" + e.getMessage());\n    throw e;\n}","preventionTips":["Merge config files key-wise, never by concatenating text.","CI check that top-level YAML keys are unique.","Avoid append-style edits that can duplicate sections.","Review generated-config diffs for repeated blocks."],"tags":["yaml","config","duplicate-key"],"backgroundTag":"schema-validation-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}