quarkusio/quarkus · error · CodestartStructureException

Multiple files found for path with executable FileStrategy:

Error message

Multiple files found for path with executable FileStrategy: + relativePath

What it means

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.

Source

Thrown at independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/strategy/ExecutableFileStrategyHandler.java:26

import io.quarkus.devtools.codestarts.CodestartStructureException;
import io.quarkus.devtools.codestarts.core.reader.TargetFile;

final class ExecutableFileStrategyHandler implements CodestartFileStrategyHandler {

    @Override
    public String name() {
        return "executable";
    }

    @Override
    public void process(Path targetDirectory, String relativePath, List<TargetFile> codestartFiles, Map<String, Object> data)
            throws IOException {
        checkNotEmptyCodestartFiles(codestartFiles);
        final Path targetPath = targetDirectory.resolve(relativePath);
        checkTargetDoesNotExist(targetPath);
        if (codestartFiles.size() > 1) {
            throw new CodestartStructureException(
                    "Multiple files found for path with executable FileStrategy: " + relativePath);
        }
        createDirectories(targetPath);
        writeFile(targetPath, codestartFiles.get(0).getContent());
        final File file = targetPath.toFile();
        file.setExecutable(true, false);
        file.setReadable(true, false);
        file.setWritable(true, true);
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Remove or rename the duplicate executable file in one of the codestarts so only one provider remains per path
  2. Exclude one of the conflicting codestarts from the selection
  3. Change the output strategy for one of the files (e.g. merge or override) in the codestart's output-strategy definition

Example fix

// before (codestart A and B both define)
.codestart/output-strategy: scripts/init.sh -> executable

// after
codestart A: scripts/init.sh -> executable
codestart B: scripts/init.sh -> override (or removed)
Defensive patterns

Strategy: validation

Validate before calling

Map<String, List<TargetFile>> byPath = files.stream().collect(groupingBy(TargetFile::getRelativePath));
List<String> dupes = byPath.entrySet().stream()
    .filter(e -> e.getValue().size() > 1)
    .map(Map.Entry::getKey).toList();
if (!dupes.isEmpty()) throw new IllegalStateException("Duplicate executable paths: " + dupes);

Try / catch

try {
    handler.process(targetDir, relativePath, codestartFiles, data);
} catch (CodestartStructureException e) {
    if (e.getMessage().startsWith("Multiple files found")) {
        // inspect codestart selection and drop the duplicate provider
    } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/f564771988cdb3ff. Report an issue: GitHub.