{"record":{"id":"7e00d4137293baa4","repo":"pinpoint-apm/pinpoint","slug":"duplicate-changeset-id","errorCode":null,"errorMessage":"Duplicate changeSet id : ","messagePattern":"Duplicate changeSet id : ","errorType":"validation","errorClass":"InvalidHbaseSchemaException","httpStatus":null,"severity":"error","filePath":"hbase/hbase-schema/src/main/java/com/navercorp/pinpoint/hbase/schema/reader/xml/mapper/HbaseSchemaMapper.java","lineNumber":75,"sourceCode":"        for (HbaseSchema.Include schemaInclude : schemaIncludes) {\n            String includeFile = schemaInclude.getFile();\n            if (includeFiles.contains(includeFile)) {\n                throw new InvalidHbaseSchemaException(\"Duplicate include file : \" + includeFile);\n            }\n            includeFiles.add(includeFile);\n        }\n        return includeFiles;\n    }\n\n    private Collection<ChangeSet> mapChangeSets(List<com.navercorp.pinpoint.hbase.schema.definition.xml.ChangeSet> schemaChangeSets) {\n        if (CollectionUtils.isEmpty(schemaChangeSets)) {\n            return Collections.emptySet();\n        }\n        Map<String, ChangeSet> changeSets = new LinkedHashMap<>();\n        for (com.navercorp.pinpoint.hbase.schema.definition.xml.ChangeSet schemaChangeSet : schemaChangeSets) {\n            String changeSetId = schemaChangeSet.getId();\n            if (changeSets.containsKey(changeSetId)) {\n                throw new InvalidHbaseSchemaException(\"Duplicate changeSet id : \" + changeSetId);\n            }\n            ChangeSet changeSet = changeSetMapper.mapChangeSet(schemaChangeSet);\n            changeSets.put(changeSetId, changeSet);\n        }\n        return changeSets.values();\n    }\n}\n","sourceCodeStart":57,"sourceCodeEnd":83,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/hbase/hbase-schema/src/main/java/com/navercorp/pinpoint/hbase/schema/reader/xml/mapper/HbaseSchemaMapper.java#L57-L83","documentation":"Thrown by HbaseSchemaMapper.mapChangeSets when two <changeSet> elements in the schema XML share the same id attribute. ChangeSet ids are the primary key for tracking which changes were applied (schema change log), so duplicates make execution order and idempotency ambiguous. The mapper fails fast while mapping the XML definition.","triggerScenarios":"Parsing a schema definition where changeSets() is called and schemaChangeSet.getId() returns a value already seen in the LinkedHashMap during the same file's mapping.","commonSituations":"Copy-pasting a changeSet block and forgetting to bump the id; cherry-picking/merging branches that both added a changeSet with the same id; id collisions after XML refactoring.","solutions":["Give each <changeSet id=\"...\"> a unique id (re-run and fix each duplicate reported).","Never reuse an id for a modified change — add a new changeSet with a new id instead, since executed change sets are recorded by id.","Add a unit test that loads all schema XML files through HbaseSchemaMapper to catch duplicates in CI."],"exampleFix":"<!-- before -->\n<changeSet id=\"create-agent-table\" ...>...</changeSet>\n<changeSet id=\"create-agent-table\" ...>...</changeSet>\n<!-- after -->\n<changeSet id=\"create-agent-table\" ...>...</changeSet>\n<changeSet id=\"add-agent-columnfamily\" ...>...</changeSet>","handlingStrategy":"validation","validationCode":"Set<String> ids = new HashSet<>();\nfor (ChangeSet cs : schema.getChangeSets()) {\n    if (!ids.add(cs.getId())) {\n        throw new IllegalArgumentException(\"Duplicate changeSet id: \" + cs.getId());\n    }\n}","typeGuard":null,"tryCatchPattern":"try { mapper.mapChangeSets(xmlChangeSets); } catch (InvalidHbaseSchemaException e) { fail(\"Fix duplicate changeSet id: \" + e.getMessage()); }","preventionTips":["Use a naming convention (date/purpose) so ids stay unique","Never edit an already-released changeSet id","Parse all schema XML in unit tests"],"tags":["schema-validation","duplicate-id","hbase"],"backgroundTag":"schema-validation-failed","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}