{"record":{"id":"f564771988cdb3ff","repo":"quarkusio/quarkus","slug":"multiple-files-found-for-path-with-executable-file","errorCode":null,"errorMessage":"Multiple files found for path with executable FileStrategy: + relativePath","messagePattern":"Multiple files found for path with executable FileStrategy: \\+ relativePath","errorType":"exception","errorClass":"CodestartStructureException","httpStatus":null,"severity":"error","filePath":"independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/strategy/ExecutableFileStrategyHandler.java","lineNumber":26,"sourceCode":"\nimport io.quarkus.devtools.codestarts.CodestartStructureException;\nimport io.quarkus.devtools.codestarts.core.reader.TargetFile;\n\nfinal class ExecutableFileStrategyHandler implements CodestartFileStrategyHandler {\n\n    @Override\n    public String name() {\n        return \"executable\";\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        checkTargetDoesNotExist(targetPath);\n        if (codestartFiles.size() > 1) {\n            throw new CodestartStructureException(\n                    \"Multiple files found for path with executable FileStrategy: \" + relativePath);\n        }\n        createDirectories(targetPath);\n        writeFile(targetPath, codestartFiles.get(0).getContent());\n        final File file = targetPath.toFile();\n        file.setExecutable(true, false);\n        file.setReadable(true, false);\n        file.setWritable(true, true);\n    }\n}\n","sourceCodeStart":8,"sourceCodeEnd":37,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/strategy/ExecutableFileStrategyHandler.java#L8-L37","documentation":"ExecutableFileStrategyHandler throws CodestartStructureException when more than one codestart input resolves to the same relativePath that is marked with the 'executable' output strategy. The handler can only write one file to a given target path, so duplicates are ambiguous and rejected before writing. checkNotEmptyCodestartFiles already guarantees at least one file, so this only fires on the size>1 case.","triggerScenarios":"Applying codestarts where two or more selected codestarts (e.g. a base codestart and an added one) each provide a file at the same relative path with the 'executable' FileStrategy.","commonSituations":"Combining extensions/codestarts that both ship the same script (e.g. a mvnw or .mvn script or a cli entrypoint) without deduplicating; custom project codestarts colliding with quarkus base codestarts.","solutions":["Remove or rename the duplicate executable file in one of the codestarts so only one provider remains per path","Exclude one of the conflicting codestarts from the selection","Change the output strategy for one of the files (e.g. merge or override) in the codestart's output-strategy definition"],"exampleFix":"// before (codestart A and B both define)\n.codestart/output-strategy: scripts/init.sh -> executable\n\n// after\ncodestart A: scripts/init.sh -> executable\ncodestart B: scripts/init.sh -> override (or removed)","handlingStrategy":"validation","validationCode":"Map<String, List<TargetFile>> byPath = files.stream().collect(groupingBy(TargetFile::getRelativePath));\nList<String> dupes = byPath.entrySet().stream()\n    .filter(e -> e.getValue().size() > 1)\n    .map(Map.Entry::getKey).toList();\nif (!dupes.isEmpty()) throw new IllegalStateException(\"Duplicate executable paths: \" + dupes);","typeGuard":null,"tryCatchPattern":"try {\n    handler.process(targetDir, relativePath, codestartFiles, data);\n} catch (CodestartStructureException e) {\n    if (e.getMessage().startsWith(\"Multiple files found\")) {\n        // inspect codestart selection and drop the duplicate provider\n    } else throw e;\n}","preventionTips":["Deduplicate the codestart list before applying (same codestart included twice is a common cause)","Review each codestart's file list for overlapping relative paths marked executable","Favor override/merge strategies over executable for shared scripts"],"tags":["codestarts","duplicate-files","executable"],"backgroundTag":"duplicate-codestart-file","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}