{"record":{"id":"39a118be625df2bf","repo":"pinpoint-apm/pinpoint","slug":"duplicate-include-file","errorCode":null,"errorMessage":"Duplicate include file : ","messagePattern":"Duplicate include file : ","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":60,"sourceCode":"    public HbaseSchemaMapper(JAXBContext jaxbContext, Schema schema) {\n        this.changeSetMapper = new ChangeSetMapper(jaxbContext, schema);\n    }\n\n    public XmlHbaseSchemaParseResult map(HbaseSchema hbaseSchema) {\n        Set<String> includeFiles = mapIncludeFiles(hbaseSchema.getInclude());\n        Collection<ChangeSet> changeSets = mapChangeSets(hbaseSchema.getChangeSet());\n        return new XmlHbaseSchemaParseResult(includeFiles, changeSets);\n    }\n\n    private Set<String> mapIncludeFiles(List<HbaseSchema.Include> schemaIncludes) {\n        if (CollectionUtils.isEmpty(schemaIncludes)) {\n            return Collections.emptySet();\n        }\n        Set<String> includeFiles = new LinkedHashSet<>();\n        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);","sourceCodeStart":42,"sourceCodeEnd":78,"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#L42-L78","documentation":"Thrown by HbaseSchemaMapper.mapIncludeFiles when an XML hbase-schema definition file declares the same <include> file more than once. The mapper builds a LinkedHashSet of include files and fails fast to keep the include graph deterministic. It signals a validation error in the schema XML, not a runtime HBase problem.","triggerScenarios":"Loading (via HbaseSchemaReader/includeFiles) an XML schema where two <include file=\"...\"> elements reference the identical file path within the same schema definition.","commonSituations":"Copy-pasting an include block in schema.xml while adding a new include; merging schema files from branches where both added the same include; forgetting to remove an old include after refactoring.","solutions":["Open the schema XML and remove the duplicated <include file=\"...\"> entry.","If two includes are genuinely needed, verify the file attribute values differ (e.g. different paths/files).","Validate the schema XML before deployment with the same reader used at runtime so the error surfaces in CI."],"exampleFix":"<!-- before -->\n<include file=\"schema-agent.xml\"/>\n<include file=\"schema-agent.xml\"/>\n<!-- after -->\n<include file=\"schema-agent.xml\"/>","handlingStrategy":"validation","validationCode":"Set<String> seen = new HashSet<>();\nfor (HbaseSchema.Include inc : schema.getIncludes()) {\n    if (!seen.add(inc.getFile())) {\n        throw new IllegalArgumentException(\"Duplicate include: \" + inc.getFile());\n    }\n}","typeGuard":null,"tryCatchPattern":"try { schema = hbaseSchemaReader.read(xml); } catch (InvalidHbaseSchemaException e) { log.error(\"Bad schema XML: {}\", e.getMessage()); }","preventionTips":["Deduplicate include lists in schema XML before committing","Add a CI test that parses every schema XML with HbaseSchemaReader","Keep schema XML changes reviewed like code"],"tags":["schema-validation","xml-config","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"}