{"record":{"id":"fdc3127935df6514","repo":"quarkusio/quarkus","slug":"found-more-than-one-file-containing-merged-conte","errorCode":null,"errorMessage":"Found more than one file containing '{merged-content}': \" + f.getSourceName() + \", \" + template.get().getSourceName()","messagePattern":"Found more than one file containing '(.+?)': \" \\+ f\\.getSourceName\\(\\) \\+ \", \" \\+ template\\.get\\(\\)\\.getSourceName\\(\\)","errorType":"exception","errorClass":"CodestartStructureException","httpStatus":null,"severity":"error","filePath":"independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/strategy/ContentMergeCodestartFileStrategyHandler.java","lineNumber":38,"sourceCode":"\n    static final String NAME = \"content-merge\";\n\n    @Override\n    public String name() {\n        return NAME;\n    }\n\n    @Override\n    public void process(Path targetDirectory, String relativePath, List<TargetFile> codestartFiles, Map<String, Object> data)\n            throws IOException {\n        checkNotEmptyCodestartFiles(codestartFiles);\n        final Path targetPath = targetDirectory.resolve(relativePath);\n        Optional<TargetFile> template = Optional.empty();\n        final StringBuilder mergedContent = new StringBuilder();\n        for (TargetFile f : codestartFiles) {\n            if (f.getContent().contains(\"{merged-content}\")) {\n                if (template.isPresent()) {\n                    throw new CodestartStructureException(\"Found more than one file containing '{merged-content}': \"\n                            + f.getSourceName() + \", \" + template.get().getSourceName());\n                }\n                template = Optional.of(f);\n            } else {\n                mergedContent.append(f.getContent());\n            }\n        }\n        if (!template.isPresent() || mergedContent.length() == 0) {\n            return;\n        }\n        createDirectories(targetPath);\n        final String content = template.get().getContent();\n        if (content.isBlank()) {\n            return;\n        }\n        writeFile(targetPath, content.replace(\"{merged-content}\", mergedContent.toString()));\n    }\n}","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/strategy/ContentMergeCodestartFileStrategyHandler.java#L20-L56","documentation":"ContentMergeCodestartFileStrategyHandler merges multiple codestart contributions to the same file by concatenating non-template parts and splicing them where the designated template contains the literal marker '{merged-content}'. Exactly one file may contain the marker. This error is thrown when two or more files contain it, making the merge point ambiguous.","triggerScenarios":"Two codestarts contributing to the same relative path (e.g. two extensions adding to an application class) both embed '{merged-content}' in their content, and the merge strategy processes them together.","commonSituations":"Composing multiple custom codestarts that each define a merge marker for the same file; copy-pasting a template containing the marker into additional contributing files.","solutions":["Keep '{merged-content}' in exactly one contributing file for that path and remove it from the others","Make the other contributions plain content fragments without the marker","Rename the file in one codestart if they were never meant to merge"],"exampleFix":"// before: both A.java.qute and B.java.qute contain\nclass App { {merged-content} }\n// after: only A.java.qute contains it; B.java.qute contains just the fragment\nlogger.info(\"started\");","handlingStrategy":"validation","validationCode":"long n = files.stream().filter(f -> f.getContent().contains(\"{merged-content}\")).count();\nif (n > 1) throw new IllegalStateException(\"Duplicate merge marker\");","typeGuard":null,"tryCatchPattern":"try { generate.generateProject(targetDir); }\ncatch (CodestartStructureException e) {\n    if (e.getMessage().contains(\"{merged-content}\")) { /* remove duplicate marker */ }\n    else throw e;\n}","preventionTips":["One merge marker per file path","Scan codestarts for duplicate markers in CI","Document marker convention"],"tags":["codestart","file-merge","template"],"backgroundTag":"duplicate-merge-marker","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}